Skip to content

Commit

Permalink
Fixes regression causing zombie runc:[1:CHILD] processes
Browse files Browse the repository at this point in the history
Whenever processes are spawned using nsexec, a zombie runc:[1:CHILD]
process will always be created and will need to be reaped by the parent

Signed-off-by: Alex Fang <littlelightlittlefire@gmail.com>
  • Loading branch information
LittleLightLittleFire committed Mar 21, 2019
1 parent f56b4cb commit 56e3f5d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions libcontainer/process_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,8 @@ func (p *setnsProcess) execSetns() error {
}

// Clean up the zombie parent process
firstChildProcess, err := os.FindProcess(pid.PidFirstChild)
if err != nil {
return err
}
// On Unix systems FindProcess always succeeds.
firstChildProcess, _ := os.FindProcess(pid.PidFirstChild)

// Ignore the error in case the child has already been reaped for any reason
_, _ = firstChildProcess.Wait()
Expand Down Expand Up @@ -236,6 +234,14 @@ func (p *initProcess) getChildPid() (int, error) {
p.cmd.Wait()
return -1, err
}

// Clean up the zombie parent process
// On Unix systems FindProcess always succeeds.
firstChildProcess, _ := os.FindProcess(pid.PidFirstChild)

// 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 56e3f5d

Please sign in to comment.