Skip to content

Commit

Permalink
runtime_vm: Cleanup process when the Container is Stopped
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
fidencio committed Jul 24, 2020
1 parent aee8c15 commit 1503fb1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/oci/runtime_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ func (r *runtimeVM) StartContainer(c *Container) error {
if err1 := r.updateContainerStatus(c); err1 != nil {
logrus.Warningf("error updating container status %v", err1)
}

if c.state.Status == ContainerStateStopped {
if err1 := r.deleteContainer(c, true); err1 != nil {
logrus.WithError(err1).Infof("deleteContainer failed for container %s", c.ID())
}
}
} else {
logrus.Warningf("wait for %s returned: %v", c.ID(), err)
}
Expand Down

0 comments on commit 1503fb1

Please sign in to comment.