Repository navigation
Description
Description
After moving from containerd v2.2.5 to v2.3.2 (via RKE2 v1.35.6+rke2r1 → v1.36.2+rke2r1, runc unchanged at v1.4.2), nodes that run short-lived pods with VFIO/IOMMU PCI passthrough start to degrade once such a pod is deleted.
containerd itself stays up and responsive: crictl version and crictl ps return immediately and list the running containers. But the kubelet's CRI calls for the affected pod (ContainerStatus, ExecSync) return rpc error: code = Canceled desc = context canceled or DeadlineExceeded, and containerd is slow to finish the sandbox teardown (several seconds to tens of seconds between shim disconnected and Ensure that sandbox ... cleanup successfully). After that the node stops creating new sandboxes while still reporting Ready. Restarting the runtime clears the state, but it returns the next time one of these device pods is deleted.
This did not happen on containerd v2.2.5 with the same workloads, kernel, and runc.
The symptoms resemble #11674 (a container left stuck in runc init where cleanup never completes after the shim disconnects), possibly aggravated by #10583 (a blocked call serializing other requests). The difference here is that the trigger is the deletion/teardown of an already-running VFIO passthrough pod, and the behavior is a regression that appears specifically on v2.3.2.
Observed under RKE2 (rancher/rke2#10860); RKE2 maintainers confirmed they do not modify containerd and asked us to report it here.
Steps to reproduce the issue
- Run containerd v2.3.2 under kubelet with cgroup v2,
SystemdCgroup=true, runtimeio.containerd.runc.v2, runc v1.4.2. - Run pods that pass a PCI device through with VFIO/IOMMU, created and deleted frequently.
- Delete one of those pods.
- The kubelet's
ContainerStatus/ExecSyncfor that pod returncontext canceled/DeadlineExceeded, the sandbox cleanup for it lags, and the node stops creating new sandboxes, whilecrictlagainst the same socket still responds normally.
Describe the results you received and expected
Received: the runtime completes teardown very slowly for the deleted VFIO pod, specific CRI calls for it time out, and the node stops starting new pods until the runtime is restarted.
Expected: teardown completes promptly and the node keeps creating pods, as it did on containerd v2.2.5.
What version of containerd are you using?
containerd v2.3.2
Any other relevant information
$ runc --version
runc version 1.4.2
commit: v1.4.2-0-gc241c0bb
spec: 1.3.0
go: go1.25.10 X:boringcrypto
$ uname -a
Linux <node> 5.15.0-185-generic #195-Ubuntu SMP Fri Jun 19 17:11:50 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
# Ubuntu 22.04 LTS
crictl remained responsive on affected nodes (returned RuntimeVersion: v2.3.2-k3s2 and listed ~26-30 running containers with no delay), so the containerd socket itself was not down.
Show configuration if it is related to CRI plugin.
Default RKE2 CRI configuration, cgroup v2:
defaultRuntimeName: "runc"
runtimeType: "io.containerd.runc.v2"
SystemdCgroup: true
snapshotter: overlayfs (default)
containerdEndpoint: /run/k3s/containerd/containerd.sock
No custom runtime handlers beyond the default runc (and the standard Windows runhcs entry). Full kubelet and containerd logs covering the onset are available on request.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
ningmingxiao commentedon Jul 20, 2026
can you kill -10
pidof containerdwill print containerd stack at /tmp/ dir when exec timeout ? @tdabasinskastdabasinskas commentedon Jul 21, 2026
Thanks. I sent
SIGUSR1to containerd on two affected nodes while they were degraded (aContainerStatuscall had returnedcontext canceledabout a minute earlier). The dumps show a large, persistent goroutine leak rather than a momentary block.On both nodes, roughly two thirds to four fifths of all goroutines are stuck, and they have been stuck for about 47 hours, which lines up with the last runtime restart on those nodes:
They cluster in the same task-exit / shim-wait / container-IO paths on both nodes (counts from node A):
The
task.Waitgoroutines are all blocked in the ttrpc call to the shim, waiting for a task-exit that never arrives:The matching
ContainerIO.Pipe/loadShimgoroutines are blocked reading the container fifos:So it looks like the shims for these (VFIO/IOMMU device) pods never report their task exiting, and containerd's per-container exit monitors, log pipes, and
task.Waitcalls leak and never return. TheRecoverContainergoroutines are interesting: they suggest that after a runtime restart, recovery re-attaches to these containers and gets stuck again, which matches what we see operationally (a restart clears it, then it comes back). The device path here goes through CDI (container-device-interface/pkg/cdishows up in the frames).containerd.849010.stacks.log
tdabasinskas commentedon Jul 21, 2026
Is it possible it can be related to #12714 ("Update OOMKilled event handling"), which is in 2.3.x but not in 2.2.5?
It added a
cg2oom.Stop()in the shim'shandleProcessExit(cmd/containerd-shim-runc-v2/task/service.go) befores.send(TaskExit), on the shim's singleprocessExitsgoroutine.Stop()blocks on<-w.errChwaiting for the per-container OOM watcher to return. If that does not return, the shim never publishes the exit, which would leave clienttask.Wait, the container IO fifos, and the CRI exit monitors all stuck, matching the goroutine dump above. In 2.2.5 the exit was sent immediately andinternal/oomdid not exist.ningmingxiao commentedon Jul 21, 2026
from stack I can't find exec or get ContainerStatus use much time , could you raise the concurrency level? and print stack again and grep several containers log
@tdabasinskas
tdabasinskas commentedon Jul 21, 2026
You're right, exec and ContainerStatus aren't the slow calls. That dump has 1 ExecSync goroutine (0 min) and no long-blocked ContainerStatus. The ~47h-stuck ones are all task-exit: 41 task.Wait, 41 exit monitors, 14 RecoverContainer. The kubelet-side exec/status timeouts look downstream of the task-exit never being published.
What do you mean by "raise the concurrency level"?
ningmingxiao commentedon Jul 21, 2026
the issue describe ContainerStatus/ExecSync hang but I can't find it's hanging from the stack. task.Wait is a normal stack @tdabasinskas
tdabasinskas commentedon Jul 21, 2026
Agreed, a blocked
task.Waiton its own is a normal stack. These are different - they belong to orphaned shims. Thecontainerd-shim-runc-v2and its task.Wait are still alive, but the sandbox is already gone from crictl pods, and the shim's task bundle/log is deleted (its log fd points at a deleted file). So the sandbox is gone but the exit was never delivered and Wait never returned, which is not what a running container looks like.I tried to grab the shim's own goroutines with SIGUSR1, but for an orphaned shim the log target is already deleted, so the dump goes nowhere.
ningmingxiao commentedon Jul 22, 2026
can you show the log about the leak shim's container and does the leak shim have child process? @tdabasinskas
tdabasinskas commentedon Jul 22, 2026
The leaked shim has no child processes (
ps --ppid <shim>returns nothing), so the container itself is gone.Its log lines have rotated out of the current containerd.log, but the lifecycle is in an older rotated file. containerd created the sandbox, and at exit it logged a full teardown:
fuweid commentedon Jul 27, 2026
Hi @tdabasinskas could you please provide the detail about how to use
Run pods that pass a PCI device through with VFIO/IOMMU, created and deleted frequently., like pod yaml (eg, it's using host pid namespace). I would like to reproduce it in my local env. Thanks4 remaining items
ningmingxiao commentedon Jul 28, 2026
issue #13849 looks like event is dropped (it says that docker ps show container is running)pr try to fix it https://github.com/containerd/containerd/pull/13653/changes @tdabasinskas
tdabasinskas commentedon Jul 28, 2026
That fits. If Reap() drops the exit event when processExits takes more than 1s, then #12714's cg2oom.Stop is exactly the kind of thing that can push processExits past that threshold on teardown, since it blocks on the OOM watcher.
I guess that would explain why we see it on 2.3.2 and not 2.2.5, and why the shim ends up alive with no children and no task-exit. #13849 looks like the same drop reached through lock contention instead. Queuing the events in #13653 so a slow consumer can't drop them looks like it would cover our case too.
fuweid commentedon Jul 29, 2026
@tdabasinskas did you use share-pid-namespace in pod level? I run 10 containers with oom-killed and a lot of exec requests.
I can reproduce kind of
dead-lock issuebecause killAll invokes sub process and wait for the event.containerd/cmd/containerd-shim-runc-v2/task/service.go
Line 725 in 3845698
If the event queue is full (current is 32), it will be deadlock like this. (after 10-20 minutes, it will be gone)
If you can share more pattern about your pod yaml, it will be helpful. thanks
tdabasinskas commentedon Jul 29, 2026
No shared PID namespace at pod level, and no hostPID.
I can't share the full manifests, but the relevant traits are the ones already mentioned: a single container running a VM (so PID 1 has child processes for KillAll to reap), cgroup v2, a memory limit so it can OOM, deleted on teardown, and an httpGet readiness probe rather than exec.
fuweid commentedon Jul 29, 2026
@tdabasinskas It looks odd to me. container-level pid namespace won't trigger kill-all during handling exit events because kernel will terminate all the threads or processes before sending exit event. Ideally, reading cgroup file is pretty fast. It won't block the whole progress. If you have chance, could you please dump goroutine stack like this? #13849 (comment) thanks (if there is any related dmesg information, that will help too)
tdabasinskas commentedon Jul 29, 2026
shim-2770534-goroutines.txt
fuweid commentedon Jul 29, 2026
It looks like it was truncated.
sudo strace -f -y -e trace=write -e write=2 -s $<SIZE> -p $<SHIM-PID>if you see anything like this
goro"..., it means you need to increase '$SIZE'.tdabasinskas commentedon Jul 29, 2026
shim-2770534-full.txt
fuweid commentedon Jul 29, 2026
Thanks.
The shim looks leaky to me because there is no Wait handler. I will update if I get something
ningmingxiao commentedon Jul 29, 2026
can you see the container is still runing from ctr/crictl ? @tdabasinskas
ningmingxiao commentedon Jul 29, 2026
I guess processExits() receive event but because of unknow reason the event is dropped.
@fuweid @tdabasinskas
fuweid commentedon Jul 29, 2026
Personally, I don't want to guess here and I don't think there is missing event. containerd-cri doesn't depend on exit event. it's using Wait api to get exit event.
tdabasinskas commentedon Jul 30, 2026
No, the container is completely gone.
ctr tasks ls,ctr containers ls, andcrictl pods/ps allshow nothing for itfuweid commentedon Aug 3, 2026
Currently I can only reproduce that the kernel needs some time to unmap and unpin the VFIO memory after SIGKILL. I think this delay itself is expected. In my test, the delay increases with the amount of pinned mappings.
For a container-level PID namespace, the container init process cannot fully exit before all processes and threads in this PID namespace are gone. Only after this kernel cleanup is finished, containerd-shim can receive the process exit and generate the TaskExit event.
@tdabasinskas Could you please reproduce it again in your environment and collect the following information for one affected pod when you have chance?
Full containerd debug logs, starting before the pod deletion and continuing until the problem happens. Please include the exact pod ID, container ID and shim
How many requests containerd received for this pod during this time, especially ExecSync, ContainerStatus, StopContainer, StopPodSandbox and RemovePodSandbox. And if there is any restart operation for containerd
Whether there are any processes or threads in D state during the teardown:
A goroutine dump from the affected shim at the same time.
Any related kernel messages:
The main thing I want to confirm is: does TaskExit not appear because the container init is still exiting inside the kernel, or has the init process already disappeared but the exit event or shim shutdown is lost?
Thanks.
tdabasinskas commentedon Aug 3, 2026
I ran one controlled teardown of an idle viommu runner (SIGKILL via delete) and it came out clean: the shim exited, the task was removed from ctr, there was no D-state on the container, and no hung-task or stuck-VFIO in dmesg. So a normal teardown works fine, and the leak looks intermittent, I couldn't reproduce it on demand.
These are production nodes, so I'm limited in how much teardown experimentation I can do, and I can't reliably reproduce it here. I think we've shared what we can from our side: the containerd and shim goroutine dumps, the 2.2.5 to 2.3.2 boundary, and the leaked-shim state (idle processExits, container already gone from ctr/crictl).
If a fix lands and goes into the next version of rke2, we're glad to run it and confirm the leaked shims stop accumulating. Thanks for digging into this!