Merge pull request #3896 from sipsma/close-platform-once
runtime v2: Close platform in runc shim's Shutdown method.
This commit is contained in:
commit
1809231003
@ -378,15 +378,11 @@ func (s *service) Delete(ctx context.Context, r *taskAPI.DeleteRequest) (*taskAP
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errdefs.ToGRPC(err)
|
return nil, errdefs.ToGRPC(err)
|
||||||
}
|
}
|
||||||
// if we deleted our init task, close the platform and send the task delete event
|
// if we deleted an init task, send the task delete event
|
||||||
if r.ExecID == "" {
|
if r.ExecID == "" {
|
||||||
s.mu.Lock()
|
s.mu.Lock()
|
||||||
delete(s.containers, r.ID)
|
delete(s.containers, r.ID)
|
||||||
hasContainers := len(s.containers) > 0
|
|
||||||
s.mu.Unlock()
|
s.mu.Unlock()
|
||||||
if s.platform != nil && !hasContainers {
|
|
||||||
s.platform.Close()
|
|
||||||
}
|
|
||||||
s.send(&eventstypes.TaskDelete{
|
s.send(&eventstypes.TaskDelete{
|
||||||
ContainerID: container.ID,
|
ContainerID: container.ID,
|
||||||
Pid: uint32(p.Pid()),
|
Pid: uint32(p.Pid()),
|
||||||
@ -630,6 +626,11 @@ func (s *service) Shutdown(ctx context.Context, r *taskAPI.ShutdownRequest) (*pt
|
|||||||
}
|
}
|
||||||
s.cancel()
|
s.cancel()
|
||||||
close(s.events)
|
close(s.events)
|
||||||
|
|
||||||
|
if s.platform != nil {
|
||||||
|
s.platform.Close()
|
||||||
|
}
|
||||||
|
|
||||||
return empty, nil
|
return empty, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user