Repository navigation
Description
Description
containerd-shim-runc-v2 enters a degenerate state when the container's PID 1 process dies (crash/OOM): the shim remains alive in futex_wait_queue with zero child processes and never emits a task-exit event. The Docker daemon considers the container "running", causing all API calls to that container (stop, kill, rm -f, inspect, logs, top, stats) to block indefinitely. There is no timeout and no automatic recovery — only kill -9 on the shim PID resolves it.
This is distinct from #13326 (CmdDel blocking on CNI socket) and moby/moby#40145 (reaper.Wait mutex) — here the shim simply never detects that its child process set is empty.
Steps to reproduce the issue
- Run a container with an application that can crash or be OOM-killed (e.g. LiteLLM with Prisma, which is known to create zombie processes — Zombie process: Prisma, connection to database interrupted BerriAI/litellm#14739)
- Run multiple instances sharing backing services (Postgres/Redis) to increase resource pressure
- Wait for the container process to crash under memory pressure (high swap usage observed: 10Gi/12Gi)
- The shim remains alive with zero children; all Docker API calls to that container hang forever
Exact reproduction timing is non-deterministic (depends on when the application process crashes), but the degenerate shim state is deterministic once the crash occurs.
Describe the results you received and expected
Received:
- Container PID 1 exited, but
containerd-shim-runc-v2remained alive inS (sleeping)onfutex_do_wait - Shim had zero child processes (verified via
/proc/$pid/task/*/children) docker psshowed containers asrunning (unhealthy)docker stats --no-streamshowed-- / --(daemon couldn't read cgroup metrics)- Every API call to those containers blocked indefinitely:
stop,kill,rm -f,inspect,logs,top - Non-affected containers on the same daemon responded normally
Expected:
- Shim should detect that PID 1 has exited and emit a task-exit/task-delete event
- Daemon should mark the container as exited/dead
- At minimum, shim should have a timeout on
futex_waitwhen children == 0
Evidence
Shim state from inside Docker Desktop VM
# Accessed via: docker run --rm --pid=host --privileged alpine
# 4 shims alive with zero children
for pid in 1842 1929 2016 2103; do
children=$(cat /proc/$pid/task/*/children 2>/dev/null)
state=$(cat /proc/$pid/status | grep State)
wchan=$(cat /proc/$pid/wchan 2>/dev/null)
echo "PID $pid: children=[${children:-NONE}] $state wchan=$wchan"
done
# Output:
# PID 1842: children=[NONE] State: S (sleeping) wchan=futex_wait_queue
# PID 1929: children=[NONE] State: S (sleeping) wchan=futex_wait_queue
# PID 2016: children=[NONE] State: S (sleeping) wchan=futex_wait_queue
# PID 2103: children=[NONE] State: S (sleeping) wchan=futex_wait_queueTimeline from Docker Desktop backend logs
| Time | Event |
|---|---|
| 14:54:46 | All 4 containers healthy (port-forwarding active) |
| 14:57:06 | compose/v5.3.1 stops 2 non-litellm containers — completes in 4 sec |
| 14:57:11 | compose/v5.3.1 sends POST /stop to affected container — no response ever |
| 15:08:07 | POST /kill?signal=KILL — no response |
| 15:09:10 | compose timeout after 5 minutes, exit status 1 |
The containers were already in zombie state before any stop/kill was attempted — the very first stop hung immediately.
Resolution
# Only kill -9 on the shim PIDs resolved it
docker run --rm --pid=host --privileged alpine sh -c 'kill -9 1842 1929 2016 2103'
# Daemon then reconciled: containers marked Exited (255)What version of containerd are you using?
containerd v2.2.5 (e53c7c1516c3b2bff98eb76f1f4117477e6f4e66)
Any other relevant information
- Docker Desktop: 4.83.0 (234302)
- Docker Engine: 29.6.2
- runc: 1.3.6
- Kernel: 6.18.33.2-microsoft-standard-WSL2 (Windows 11 + WSL2)
- Application: LiteLLM (Python/uvicorn) — known to create zombie Prisma processes (Zombie process: Prisma, connection to database interrupted BerriAI/litellm#14739), but the containerd-shim should still handle PID 1 death gracefully regardless of the application behavior.
- VM-side containerd/dockerd logs were lost on restart (Docker Desktop VM logs are ephemeral), so the exact moment of PID 1 death is not captured — only the aftermath is observable.
Related issues
- containerd-shim: CmdDel blocks indefinitely on unavailable CNI socket causing ttrpc leak and persistent kubelet DeadlineExceeded #13326 — similar futex_wait_queue symptom but different trigger (CNI socket race vs PID 1 death)
- docker, dockerd and containerd stuck waiting on futex moby/moby#42682 — dockerd/containerd stuck on futex (closed as not planned)
- docker-containerd-shim stuck: cannot be stopped, removed or exec'ed moby/moby#40145 — containerd-shim stuck on reaper.Wait mutex
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsTodo
Activity
ThePlenkov commentedon Jul 25, 2026
The daemon-side behavior (blocking indefinitely on API calls when a shim is unresponsive) is tracked separately in moby/moby#53189.
ningmingxiao commentedon Jul 25, 2026
can you kill -10 shimpid ? It will print stack in containerd log @ThePlenkov
and can you see shim still have child process (may be in zombie status )?
ThePlenkov commentedon Jul 25, 2026
Thanks for the suggestion. A few clarifications:
I already tried on the shim PIDs (not -10), and it crashed Docker Desktop entirely. This is documented in my internal drill — the SIGHUP to containerd was a mistake that forced a manual restart. I'm hesitant to try additional signals without understanding what they do.
I verified the shims had ZERO children (not zombie children) via . The output showed for all 4 shims. If there were zombie children, they would have appeared in that list (zombie processes still have PIDs). The shim was truly orphaned.
The incident is already resolved — Docker Desktop was restarted, and the affected containers are now removed. I cannot reproduce the shim state to try at this time.
If this happens again, I can try to capture the stack trace — but given that crashed Docker Desktop, I'd want to understand what does differently before risking another crash. Is there documentation on what signals containerd-shim handles gracefully?
ningmingxiao commentedon Jul 28, 2026
can you add some log reproduce it looks like event is lost.
"log.L.Warnf("event with pid %d status:%d may be lost", exitEvt.Pid, exitEvt.Status) "
containerd/sys/reaper/reaper_unix.go
@ThePlenkov
ThePlenkov commentedon Jul 28, 2026
that's difficult for now - i will if i catch it again
fuweid commentedon Jul 29, 2026
Hi @ThePlenkov if you have leaky shim as you described, could you please dump shim stack like this? thanks
TzachiSh commentedon Sep 21, 2026
Confirming this on the same versions, with an extra data point that isolates the runtime as the variable.
Affected host: containerd
v2.2.5, runc1.3.6, Docker29.6.1, kernel6.12.94, Debian 13.Symptom, matching the report exactly. Two containers (GPU inference servers) entered the state independently, ~2.5h apart. Both showed
Up N hours (unhealthy)indocker pswhile their main process was a zombie:Every container-scoped daemon call blocked or failed while the daemon itself stayed responsive for other containers (
docker ps,docker version, andinspecton unaffected containers all returned normally):docker restart→container <id> PID <pid> is zombie and can not be killeddocker start→error during connect: Post ".../start"after a long hangdocker rm -f→ returned nothing, container remaineddocker inspecton the affected container → hungdocker compose up -d→ reportedStarting, container stayedExitedRecovery confirmed as described.
kill -9on the two shim PIDs (thePPIDcolumn above, not the zombies) cleared it. The zombies were reparented to PID 1 and, importantly, remained as zombies afterwards — but the daemon immediately regained control: both containers became removable and recreated cleanly on the nextcompose up. So the stuck state is the shim, not the zombie itself.The part that may help narrow it: we run the identical workload and image on three hosts, and only the
2.2.5/1.3.6host is affected.Host C shares the NVIDIA container toolkit version with the affected host and is unaffected, and the two unaffected hosts run different kernels from each other, so in our fleet neither the toolkit nor the kernel tracks the failure. The container runtime versions are the only factor that does.
Trigger, as far as we can tell: in both cases the container's PID 1 had died after its own child process exited unexpectedly (the application's engine subprocess crashed with no traceback). So the preceding condition was an abnormal PID 1 exit, consistent with the "crash/OOM" framing in the original report. The application crash itself is a separate problem on our side; what this issue costs us is that a container that would otherwise be restarted by its restart policy instead became permanently unmanageable until manual intervention, and stayed that way for 26 hours before anyone noticed.
Happy to collect anything specific from the affected host while it is still on these versions — we are about to pin it back to
2.2.4/1.3.5, so if a maintainer wants a shim stack dump,/proc/<shim>/stack, or goroutine dump from a live occurrence, say so and we will hold off.