Merge pull request #691 from lifupan/wait_before_remove

virtcontainers: wait until process exited before RemoveContainer
This commit is contained in:
Peng Tao
2018-09-04 13:16:16 +08:00
committed by GitHub

View File

@@ -890,6 +890,12 @@ func (c *Container) stop() error {
// stopContainer() to succeed in such particular case. // stopContainer() to succeed in such particular case.
c.kill(syscall.SIGKILL, true) 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 { if err := c.sandbox.agent.stopContainer(c.sandbox, *c); err != nil {
return err return err
} }