mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-23 01:04:25 +01:00
virtcontainers: wait until process exited before RemoveContainer
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 <lifupan@gmail.com>
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user