Skip to content

[release/2.4] cri: don't leak task when StartContainer cleanup fails to delete task - #14223

Merged
mxpv merged 1 commit into
containerd:release/2.4from
k8s-infra-cherrypick-robot:cherry-pick-14218-to-release/2.4
Sep 24, 2026
Merged

mxpv merged 1 commit into
containerd:release/2.4from
k8s-infra-cherrypick-robot:cherry-pick-14218-to-release/2.4

Conversation

@k8s-infra-cherrypick-robot

@k8s-infra-cherrypick-robot k8s-infra-cherrypick-robot commented Sep 24, 2026 •

Copy link
Copy Markdown

This is an automated cherry-pick of #14218

/assign mxpv

/kind resource-leak

Fix bug where failed container start cleanup leaked tasks and prevented container removal

When StartContainer fails after the task is created and the cleanup
task delete fails (e.g. it timed out on a stuck shim), the container
was still recorded as EXITED while its task remained. RemoveContainer
only reaps tasks for RUNNING and UNKNOWN containers, so every kubelet
GC retry failed with "cannot delete running task" and the container
was never collected. Record the container as UNKNOWN when task cleanup
cannot be confirmed so RemoveContainer force-stops it and retries the
cleanup, keeping the StartError reason in both cases.

Signed-off-by: Maksym Pavlenko <[email protected]>
@kubernetes-prow kubernetes-prow Bot added the kind/resource-leak Issues involving leaked processes, goroutines, file descriptors, mounts or other resources. label Sep 24, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Pull Request Review Sep 24, 2026
@mxpv
mxpv requested a review from samuelkarp September 24, 2026 19:46

@thaJeztah thaJeztah left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mxpv
mxpv merged commit ddf7128 into containerd:release/2.4 Sep 24, 2026
97 of 100 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/cri Container Runtime Interface (CRI) impact/changelog kind/resource-leak Issues involving leaked processes, goroutines, file descriptors, mounts or other resources. size/L

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants