Skip to content

Orphaned shim state files in /run/containerd/runc are not cleaned up after shim is SIGKILLed #13293

Closed

Description

@wtootw

Description

I am currently running containerd v2.2.3. I have observed that if a containerd-shim-runc-v2 process is forcefully terminated via kill -9 (SIGKILL) — simulating an unexpected crash or manual intervention — the shim naturally cannot execute its graceful shutdown routine. As a result, container state files and directories indefinitely linger in /run/containerd/runc/k8s.io//.
It is worth noting that this issue does not occur in containerd v1.7.5, which clearly indicates a regression.

Steps to reproduce the issue

  1. Create a test Pod

kubectl apply -f test.yaml
POD_ID=$(crictl pods --name test -q)

  1. Record initial state countCheck how many state directories exist before the crash

ls /run/containerd/runc/k8s.io/ | wc -l

  1. Identify and Kill the Shimbash

SHIM_PID=$(ps -ef | grep "containerd-shim-runc-v2" | grep $POD_ID | awk '{print $2}')
kill -9 $SHIM_PID

  1. Observe the Leak (The "wc -l" test)Wait a few seconds for containerd to process the exit, then check the count again.bash

ls /run/containerd/runc/k8s.io/ | wc -l

Describe the results you received and expected

In version v1.7.5, old container directories are properly cleaned up. As a result, the total number of container directories remains unchanged after operations.

In version v2.2.2, old container directories are not cleaned up. Each operation leaves the previous directory behind, causing the directory count to increase by 1 every time.

This leads to an accumulation of unnecessary directories in v2.2.3, whereas v1.7.2 keeps the environment tidy.

What version of containerd are you using?

containerd github.com/containerd/containerd/v2 v2.2.3 77c8424

Any other relevant information

kubelet --version
Kubernetes v1.35.0

runc --version
runc version 1.4.2
commit: a5677b37
spec: 1.3.0
go: go1.24.3
libseccomp: 2.5.3

Show configuration if it is related to CRI plugin.

No response

Activity

  1. ningmingxiao commented on Apr 28, 2026

    @ningmingxiao
    Contributor

    I will try to fix it. @wtootw

  2. ningmingxiao commented on Apr 28, 2026

    @ningmingxiao
    Contributor
  3. added
    kind/resource-leak
    on Aug 27, 2026
  4. reopened this on Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/runtimekind/bugkind/resource-leak

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions