Notify containerd of init death before waiting for children in shim

Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
Kenfe-Mickael Laventure 2016-09-19 13:34:05 -07:00
parent 4eb3147efc
commit 61338577b5

View file

@ -117,11 +117,17 @@ func start(log *os.File) error {
} }
// runtime has exited so the shim can also exit // runtime has exited so the shim can also exit
if exitShim { if exitShim {
// Wait for all the childs this process may have created // Let containerd take care of calling the runtime
// (only needed for exec, but it won't hurt when done on init) // delete.
osutils.Reap(true) // This is needed to be done first in order to ensure
// Let containerd take care of calling the runtime delete // that the call to Reap does not block until all
// children of the container have died if init was not
// started in its own PID namespace.
f.Close() f.Close()
// Wait for all the childs this process may have
// created (needed for exec and init processes when
// they join another pid namespace)
osutils.Reap(true)
p.Wait() p.Wait()
return nil return nil
} }