Skip to content

Commit

Permalink
ensure we call wait() on children created by nsenter
Browse files Browse the repository at this point in the history
we were ending up with 1 zombie for every container created, since
nothing was waiting on the intermediate child created by nsenter.

Signed-off-by: James Pepin <[email protected]>
  • Loading branch information
pepin committed Jan 22, 2019
1 parent c1e454b commit b55bb58
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libcontainer/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,15 @@ func (p *initProcess) getChildPid() (int, error) {
p.cmd.Wait()
return -1, err
}
// Clean up the zombie parent process && ignore errors like in setnsProcess
firstChildProcess, err := os.FindProcess(pid.PidFirstChild)
if err != nil {
return pid.Pid, nil
}

// Ignore the error in case the child has already been reaped for any reason
_, _ = firstChildProcess.Wait()

return pid.Pid, nil
}

Expand Down

0 comments on commit b55bb58

Please sign in to comment.