Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
shim-v2: fix shim leak when hypervisor exit unexpectly
Browse files Browse the repository at this point in the history
Fixes: #1929

in containerd-kata-v2, container can only be deleted in Delete
interface, or other shim operates(like kill/delete) all fails
since can not get container info.

Signed-off-by: Ace-Tang <[email protected]>
  • Loading branch information
Ace-Tang committed Aug 5, 2019
1 parent 00e0aaa commit 8ad6b0e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 4 additions & 0 deletions containerd-shim-v2/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,10 @@ func (s *service) Kill(ctx context.Context, r *taskAPI.KillRequest) (_ *ptypes.E
return nil, err
}

if status, _ := s.sandbox.StatusContainer(c.id); status.State.State == types.StateStopped {
return empty, nil
}

// According to CRI specs, kubelet will call StopPodSandbox()
// at least once before calling RemovePodSandbox, and this call
// is idempotent, and must not return an error if all relevant
Expand Down
1 change: 0 additions & 1 deletion containerd-shim-v2/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ func watchSandbox(s *service) {
}
}
}
s.containers = make(map[string]*container)

// Existing container/exec will be cleaned up by its waiters.
// No need to send async events here.
Expand Down

0 comments on commit 8ad6b0e

Please sign in to comment.