Commit Graph
7 Commits
Author SHA1 Message Date
Wei Fu 1ac97c2c13 *: properly shutdown non-groupable shims to prevent resource leaks
Previously, to address issue #11708, PR #11793 changed containerd to always
invoke the shim binary to establish shim connections, rather than reusing the
sandbox shim. However, this change did not ensure that the Shutdown API was
called to stop the shim process.

Starting with containerd v2.0.0, the Shutdown API is only invoked for sandbox
containers (when container.SandboxID is empty). This approach works for
groupable shims, where multiple containers share a single socket address and
only require a single Shutdown call. However, for non-groupable shims, each
container requires its own Shutdown call during cleanup to avoid leaking shim
processes.

Additionally, PR #11793 introduced a corner case during upgrades:
- T1: An old container-shim-runc-v2 (<=v1.7.X) is running for pod A.
- T2: containerd is upgraded to v2.X.Y.
- T3: A new container A-C1 is created in pod A using the new shim-runc-v2 binary.
- T4: bootstrap.json indicates version:3 protocol, but it is downgraded to version:2 in memory.
- T5: containerd is restarted.
- T6: containerd fails to connect to A-C1.
- T7: The A-C1 container is left in EXITED status in the CRI plugin.

To address this, ensure that loadShimTask downgrades to version:2 if necessary,
and always invoke the Shutdown API for each non-groupable shim during cleanup to
prevent resource leaks and handle upgrade scenarios correctly.

(Introduced by #11793)

Signed-off-by: Wei Fu <fuweid89@gmail.com>
2025-06-02 00:01:08 -04:00
Wei Fuandyang yang 1c70f237cb integration: add testcase to recover ungroupable shim
Signed-off-by: Wei Fu <fuweid89@gmail.com>
Co-authored-by: yang yang <yang8518296@163.com>
2025-05-06 01:54:43 -04:00
Derek McGowan bca39a6f46 Add documentation for test for issue 10467
Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-31 17:32:56 -07:00
Derek McGowan 713f753e5d Update release upgrade tests to test 1.7 and 2.0
Fix 1.7 config to match previous version which allowed upgrade to 2.x.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-31 17:32:55 -07:00
Derek McGowan 9d05ae03b7 Revert "Remove test for issue 10467"
This reverts commit 12762891d6.

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-31 17:32:55 -07:00
Derek McGowan 12762891d6 Remove test for issue 10467
This test relates to an upgrade in 1.7 and not needed in latest version

Signed-off-by: Derek McGowan <derek@mcg.dev>
2025-03-12 11:18:44 -07:00
Wei Fu 4cfeb7b19e core/metadata: migrate sandboxes bucket into v1
Signed-off-by: Wei Fu <fuweid89@gmail.com>
2024-07-30 21:37:35 +08:00