Skip to content

daemon: ignore duplicate task exit events in daemon state#51925

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
fuweid:fix-46212
Jan 27, 2026
Merged

daemon: ignore duplicate task exit events in daemon state#51925
cpuguy83 merged 1 commit intomoby:masterfrom
fuweid:fix-46212

Conversation

@fuweid
Copy link
Contributor

@fuweid fuweid commented Jan 26, 2026

- What I did

  • Added daemon-side duplicate TaskExit filtering based on container state and timestamps
    to avoid reprocessing late exits.

- How I did it

  • Introduced shouldIgnoreExitEventWithLock in daemon/monitor.go and invoked
    it from handleContainerExit while holding the container lock.
  • Ignored duplicates when the container is removing/exited/dead, or when a
    restart is in progress and the exit timestamp is newer than FinishedAt, or
    when a new task is already running and the exit predates StartedAt.

- How to verify it

  • Manually run a workload that triggers duplicate TaskExit events (e.g., shim
    panic during restart) and confirm no state regressions.
    • Manually build containerd and force it to send duplicate TaskExit on task.Delete API call
    • Using failpoint-based shim to run
      • docker run -d --runtime runc-fp --annotation "io.containerd.runtime.v2.shim.failpoint.Delete=1*panic(oops)" ubuntu:latest sleep 5

- Human readable description for the release notes

Fix daemon handling of duplicate container exit events to avoid repeated cleanup and state transitions.

- A picture of a cute animal (not mandatory but encouraged)

REF: #46212

Handle duplicate TaskExit events by checking container state and timestamps
while holding the container lock. Ignore late duplicates when restarting or
when a newer task is already running.

Signed-off-by: Wei Fu <fuweid89@gmail.com>
@github-actions github-actions bot added the area/daemon Core Engine label Jan 26, 2026
@fuweid
Copy link
Contributor Author

fuweid commented Jan 26, 2026

ping @dmcgowan @AkihiroSuda for review when you have chance. thanks

Copy link

@lingotesoropuro-jpg lingotesoropuro-jpg left a comment

Choose a reason for hiding this comment

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

Gracias

Copy link

@lingotesoropuro-jpg lingotesoropuro-jpg left a comment

Choose a reason for hiding this comment

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

Gracias

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/daemon Core Engine impact/changelog kind/bug Bugs are bugs. The cause may or may not be known at triage time so debugging may be needed. process/cherry-pick/25.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants