Skip to content

Do not transition shim to stopped state from a state query - #14646

Merged
copybara-service[bot] merged 1 commit into
google:masterfrom
konstantin-s-bogom:shim-stopped-latch-fix
Sep 9, 2026
Merged

copybara-service[bot] merged 1 commit into
google:masterfrom
konstantin-s-bogom:shim-stopped-latch-fix

Conversation

@konstantin-s-bogom

Copy link
Copy Markdown
Member

createdState.State and runningState.State transitioned the shim's init process to stoppedState whenever a single runsc state call answered "stopped". That transition bypasses SetExited: waitBlock is never closed, no TaskExit event is published, and handleStoppedKill silently swallows all subsequent kills, so containerd waits forever and the container can never be torn down.

This behaviour comes from commit 1e472a8, which tried to fix the opposite problem of containerd never seeing that a container died due to query errors. However, this part was never essential, because the real fixes had to do with state queries on dead or deleted containers erroring out. In light of #14645, there is now a concrete example of a buggy runsc not being an authoritative and irreversible source for the stopped state, so kills can be accepted but dropped, and the pod will be stuck terminating forever.

createdState.State and runningState.State transitioned the shim's init
process to stoppedState whenever a single `runsc state` call answered
"stopped". That transition bypasses SetExited: waitBlock is never
closed, no TaskExit event is published, and handleStoppedKill silently
swallows all subsequent kills, so containerd waits forever and the
container can never be torn down.

This behaviour comes from commit 1e472a8, which tried to fix the
opposite problem of containerd never seeing that a container died due
to query errors. However, this part was never essential, because the
real fixes had to do with state queries on dead or deleted containers
erroring out. In light of google#14645,
there is now a concrete example of a buggy runsc not being an
authoritative and irreversible source for the stopped state, so kills
can be accepted but dropped, and the pod was stuck terminating forever.
copybara-service Bot pushed a commit that referenced this pull request Sep 9, 2026
createdState.State and runningState.State transitioned the shim's init process to stoppedState whenever a single `runsc state` call answered "stopped". That transition bypasses SetExited: waitBlock is never closed, no TaskExit event is published, and handleStoppedKill silently swallows all subsequent kills, so containerd waits forever and the container can never be torn down.

This behaviour comes from commit 1e472a8, which tried to fix the opposite problem of containerd never seeing that a container died due to query errors. However, this part was never essential, because the real fixes had to do with state queries on dead or deleted containers erroring out. In light of #14645, there is now a concrete example of a buggy runsc not being an authoritative and irreversible source for the stopped state, so kills can be accepted but dropped, and the pod will be stuck terminating forever.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#14646 from konstantin-s-bogom:shim-stopped-latch-fix ecc1bf7
PiperOrigin-RevId: 978203572
@copybara-service
copybara-service Bot merged commit fc158eb into google:master Sep 9, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants