Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: wait until process exited before RemoveContainer
Browse files Browse the repository at this point in the history
RemoveContainer is called right after SignalProcess(SIGKILL), the container
process might be still running and container Destroy() will fail, thus it's better
to wait on this process exited before to issue RemoveContainer.

Fixes: #690

Signed-off-by: fupan <[email protected]>
  • Loading branch information
lifupan committed Sep 3, 2018
1 parent a39a3f1 commit a5478b9
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions virtcontainers/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,12 @@ func (c *Container) stop() error {
// stopContainer() to succeed in such particular case.
c.kill(syscall.SIGKILL, true)

// Since the agent has supported the MultiWaitProcess, it's better to
// wait the process here to make sure the process has exited before to
// issue stopContainer, otherwise the RemoveContainerRequest in it will
// get failed if the process hasn't exited.
c.sandbox.agent.waitProcess(c, c.id)

if err := c.sandbox.agent.stopContainer(c.sandbox, *c); err != nil {
return err
}
Expand Down

0 comments on commit a5478b9

Please sign in to comment.