Repository navigation
Description
Description
The snapshot garbage collector in core/metadata can permanently wedge every snapshot operation on a node when a proxy snapshotter stops answering.
garbageCollect holds the snapshotter write lock for the whole pass, and pruneBranch calls the underlying Snapshotter.Remove under that lock with no deadline. cleanupSnapshotter also strips cancellation with context.WithoutCancel, so nothing can interrupt the call from above. If the snapshotter is a proxy plugin whose connection has stopped responding, the Remove RPC blocks forever, the lock is never released, and every snapshot operation after that (including CRI RunPodSandbox) queues behind it until containerd is restarted. The node keeps reporting Ready the whole time, so nothing evicts or replaces it.
There is an old TODO in the code about this: core/metadata/snapshot.go has "TODO: Unlock before removal".
Steps to reproduce the issue
- Configure a proxy snapshotter as the CRI snapshotter (we hit this with soci-snapshotter, but any proxy plugin works).
- Wedge the proxy's gRPC connection so an in-flight Remove never gets response headers. In our case the snapshotter stopped serving containerd's long-lived connection after running out of file descriptors ([Bug] content_store=containerd: cross-process bbolt/lease deadlock between soci-snapshotter and containerd on first boot awslabs/soci-snapshotter#2037 is a similar report).
- Have at least one orphaned snapshot so GC calls Remove.
- Wait for the GC scheduler to run.
After that, every pod sandbox creation on the node fails with RunPodSandbox ... DeadlineExceeded.
Describe the results you received and expected
What we saw in production (containerd 2.2.3), from goroutine dumps of both daemons:
The GC goroutine sat blocked for 410 minutes:
goroutine 61 [sync.WaitGroup.Wait, 410 minutes]:
github.com/containerd/containerd/v2/core/metadata.(*DB).GarbageCollect (db.go:476)
github.com/containerd/containerd/v2/plugins/gc.(*gcScheduler).run
Its cleanup worker was parked in the proxied Remove with no deadline:
goroutine 25822900 [select, 410 minutes]:
google.golang.org/grpc/internal/transport.(*ClientStream).waitOnHeader
...
core/snapshots/proxy.(*proxySnapshotter).Remove
core/metadata.(*snapshotter).pruneBranch
17 CRI operations (RemoveContainer and the sandbox creation path) were blocked on the metadata snapshotter RWMutex for the same duration, and 40 gc-scheduler mutationCallback goroutines piled up on an unread channel.
Expected: a snapshotter that stops answering should turn into an error and a retry on the next GC pass, not disable pod creation on the node until someone restarts containerd.
What version of containerd are you using?
2.2.3 (the code is the same on main)
Any other relevant information
Fix proposed in #13799. Can share the full goroutine dumps if useful.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
NahumLitvin commentedon Jul 15, 2026
Turned out the trigger on our side was an fd leak in soci's lazy loading path (one leaked spancache fd per verified file), fixed in awslabs/soci-snapshotter#2043. That explains how the snapshotter got wedged. This issue and #13799 are about containerd surviving a snapshotter that stops answering, whatever the cause.
NahumLitvin commentedon Aug 10, 2026
@dmcgowan