You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shim leak and stale container state if containerd restarts during a StopContainer operation #12600
When the containerd service is restarted while a StopContainer operation is in progress, containerd can lose track of the container's shim. This results in the container's state not being updated, even after the container process has exited. Kubelet continues to see the container as running (via CRI) and gets stuck in a loop trying to terminate a process that no longer exists, causing the pod to be stuck in the Terminating state.
Steps to reproduce the issue
No response
Describe the results you received and expected
Expected behavior
containerd should gracefully handle the restart and correctly reflect the container's final state (i.e., Exited) after the restart, even if the stop operation was interrupted. The shim should be cleaned up.
Actual Behavior
The StopContainer call in the original containerd instance fails with context canceled due to the shutdown.
After restart, containerd does not have the correct state for the container. crictl ps -a may show the container still as Running.
The container process does exit, but this event seems to be missed or not reconciled by the restarted containerd instance.
Kubelet receives DeadlineExceeded errors when trying to kill the container, as it's querying containerd which reports a stale state.
Critically, log messages like "shim disconnected" or "cleaning up after shim disconnected" are missing for the affected container ID after the restart, suggesting an orphaned shim
What version of containerd are you using?
v1.7.27
Any other relevant information
No response
Show configuration if it is related to CRI plugin.
can you show containerd log and containerd stack (kill -10 pidof containerd will generate stack at /tmp/)@bansodek-prog
as far as I know containerd will recheck the container status, when restart containerd.
Hi, @bansodek-prog. I'm Dosu, and I'm helping the containerd team manage their backlog and am marking this issue as stale.
Issue Summary
You reported that on containerd v1.7.27, a container can get stuck in Terminating if containerd restarts during StopContainer.
The reported behavior suggests containerd may lose track of the shim after restart, fail to reconcile the final state, and continue reporting the container as Running even after the process has exited.
In the discussion, @ningmingxiao requested containerd logs and a stack dump to confirm the restart/reconciliation path, and suggested containerd should recheck container status after restart.
This issue was closed because it has been stale for 2 weeks with no activity. Feel free to reopen or create a new issue if you would like to continue working on it.
Activity
ningmingxiao commentedon Dec 1, 2025
can you show containerd log and containerd stack (kill -10
pidof containerdwill generate stack at /tmp/)@bansodek-progas far as I know containerd will recheck the container status, when restart containerd.
ningmingxiao commentedon Dec 1, 2025
//assign
ningmingxiao commentedon Dec 1, 2025
may be you need this pr #11634 @bansodek-prog
dosubot commentedon Jul 28, 2026
Hi, @bansodek-prog. I'm Dosu, and I'm helping the containerd team manage their backlog and am marking this issue as stale.
Issue Summary
Terminatingif containerd restarts duringStopContainer.Runningeven after the process has exited.Next Steps
Thanks for your understanding and contribution.
github-actions commentedon Aug 12, 2026
This issue was closed because it has been stale for 2 weeks with no activity. Feel free to reopen or create a new issue if you would like to continue working on it.