Skip to content

Commit

Permalink
sandbox: Disconnect from agent after VM shutdown
Browse files Browse the repository at this point in the history
When a one-shot pod dies in CRI-O, the shimv2 process isn't killed until
the pod is actually deleted, even though the VM is shut down. In this
case, the shim appears to busyloop when attempting to talk to the (now
dead) agent via VSOCK. To address this, we disconnect from the agent
after the VM is shut down.

This is especially catastrophic for one-shot pods that may persist for
hours or days, but it also applies to any shimv2 pod where Kata is
configured to use VSOCK for communication.

Backport of kata-containers/kata-containers#556
to kata-containers/runtime master branch.

See github.com/kata-containers#2719 for details.
Fixes kata-containers#2719

Signed-off-by: Evan Foster <[email protected]>
  • Loading branch information
Evan Foster authored and jcvenegas committed Oct 19, 2020
1 parent 9d82056 commit 7b09e96
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions virtcontainers/sandbox.go
Original file line number Diff line number Diff line change
Expand Up @@ -1605,6 +1605,11 @@ func (s *Sandbox) Stop(force bool) error {
return err
}

// Stop communicating with the agent.
if err := s.agent.disconnect(); err != nil && !force {
return err
}

return nil
}

Expand Down

0 comments on commit 7b09e96

Please sign in to comment.