Skip to content

Fix deadlock in events forwarding when connection closes#141

Merged
akerouanton merged 1 commit intocontainerd:mainfrom
dmcgowan:fix-events-deadlock
Apr 1, 2026
Merged

Fix deadlock in events forwarding when connection closes#141
akerouanton merged 1 commit intocontainerd:mainfrom
dmcgowan:fix-events-deadlock

Conversation

@dmcgowan
Copy link
Copy Markdown
Member

@dmcgowan dmcgowan commented Apr 1, 2026

Use the service context to prevent the stream receiver from exiting when the connection which started it closes. This can cause a deadlock in the ttrpc stream waiting for events to be received without any receiver to consume them.

Use the service context to prevent the stream receiver from exiting when
the connection which started it closes. This can cause a deadlock in the
ttrpc stream waiting for events to be received without any receiver to
consume them.

Signed-off-by: Derek McGowan <derek@mcg.dev>
Copilot AI review requested due to automatic review settings April 1, 2026 01:47
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a deadlock scenario in the shim’s VM event forwarding by ensuring the VM event stream receiver is not tied to the lifetime of the RPC connection that initiated it.

Changes:

  • Switch the VM events Stream call to use the shim’s long-lived service context rather than the per-RPC context.
  • Add in-code documentation explaining the deadlock mechanism and why the long-lived context is required.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/shim/task/service.go
@akerouanton akerouanton merged commit f510872 into containerd:main Apr 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants