Skip to content

Commit 67dcd05

Browse files
committed
runtime_vm: Cleanup process when the Container is Stopped
When the container finishes its execution a containerd-shim-kata-v2 process is left behind (only when using CRI-O). The reason for that seems to be CRI-O not doing a cleanup of the process whenever the container state has changed its state from running to stopped. The most reasonable way found to perform such cleanup seems to be taking advantage of the goroutine used to update the container status and performing the cleanup there, whenever it's needed. Related: kata-containers/runtime#2719 Signed-off-by: Fabiano Fidêncio <[email protected]> (cherry picked from commit 814c1bb) (cherry picked from commit adb657c)
1 parent 0957c45 commit 67dcd05

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/oci/runtime_vm.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,12 @@ func (r *runtimeVM) StartContainer(c *Container) error {
261261
if err1 := r.updateContainerStatus(c); err1 != nil {
262262
logrus.Warningf("error updating container status %v", err1)
263263
}
264+
265+
if c.state.Status == ContainerStateStopped {
266+
if err1 := r.deleteContainer(c, true); err1 != nil {
267+
logrus.WithError(err1).Infof("deleteContainer failed for container %s", c.ID())
268+
}
269+
}
264270
}
265271
}()
266272

0 commit comments

Comments
 (0)