linux: Ensure all init children are dead when it exits
This ensure that when using the host pid, we don't let process alive, preventing Wait() to return until they all die. Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
@@ -393,6 +393,14 @@ func (s *Service) checkProcesses(e runc.Exit) {
|
||||
defer s.mu.Unlock()
|
||||
for _, p := range s.processes {
|
||||
if p.Pid() == e.Pid {
|
||||
if ip, ok := p.(*initProcess); ok {
|
||||
// Ensure all children are killed
|
||||
if err := ip.killAll(s.context); err != nil {
|
||||
log.G(s.context).WithError(err).WithField("id", ip.ID()).
|
||||
Error("failed to kill init's children")
|
||||
}
|
||||
}
|
||||
|
||||
p.SetExited(e.Status)
|
||||
s.events <- &eventsapi.TaskExit{
|
||||
ContainerID: s.id,
|
||||
|
Reference in New Issue
Block a user