Skip to content

Commit

Permalink
runtime_vm: Avoid premature container info cleanup on creation failure
Browse files Browse the repository at this point in the history
While the removing the container info of the failed container from the
containers' map seems harmless, it'll end up causing an error when
actually cleaning up / deleting the failed container.

The reason for this is that CreateContainer, on Kata side, will remove
the failed container, wich will result on DeleteContainer, on the CRI-O
side, being called and then failing to actually remove the container, as
its info has already been removed from the containers' map.

This issue has been reported as part of a PR opened by Evan Foster:
kata-containers/runtime#2826 (comment)

Signed-off-by: Fabiano Fidêncio <fidencio@redhat.com>
Tested-by: Evan Foster <efoster@adobe.com>
  • Loading branch information
fidencio committed Jul 13, 2020
1 parent e8f8348 commit 8705686
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions internal/oci/runtime_vm.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,6 @@ func (r *runtimeVM) CreateContainer(c *Container, cgroupParent string) (err erro
cio: containerIO,
}

defer func() {
if err != nil {
delete(r.ctrs, c.ID())
}
}()

// We can now create the container, interacting with the server
request := &task.CreateTaskRequest{
ID: c.ID(),
Expand Down

0 comments on commit 8705686

Please sign in to comment.