Files
kata-containers/src/runtime/pkg
Fabiano Fidêncio d3291b8778 runtime: publish TaskExit before sandbox teardown
Docker and containerd rely on the TaskExit event and a prompt Wait RPC,
not just the eventual sandbox teardown.  With the original ordering the
shim tore the sandbox down (Stop/Delete the guest) *before* publishing
the container exit, so for a slow guest shutdown -- e.g. the nvidia-gpu
config with an 8GB /dev/shm memory-backend on a constrained CI runner --
containerd could SIGKILL the shim before the exit was published.  The
`docker run --rm` removal then races the dead-shim cleanup and fails,
even though the container itself exited 0.

Publish the container exit (c.exitCh) and the TaskExit event *before*
the sandbox teardown, and run the teardown without holding s.mu so
concurrent Delete()/Shutdown() RPCs are not blocked.

To keep the guarantees the previous ordering provided:

  * teardownWg lets Shutdown() wait for an in-flight teardown to finish,
    so the sandbox run directory (watched by kata-monitor) and the CRI
    state are gone before the shim exits -- without holding s.mu across
    the slow guest shutdown; and
  * teardownOnce serialises wait()'s teardown with watchSandbox()'s
    killed-VMM teardown so the (not internally synchronized)
    Sandbox.Stop/Delete never run concurrently.

Signed-off-by: Fabiano Fidêncio <ffidencio@nvidia.com>
2026-07-08 13:12:19 +02:00
..

Kata golang packages

This repository contains a number of packages in addition to the virtcontainers package:

Package name Description
katatestutils Unit test utilities.
katautils Utilities.
signals Signal handling functions.