mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-05 19:47:53 +00: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:
parent
a39a3f15a3
commit
a5478b93e0
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user