Skip to content

Fix deadlock when stream is not consumed - #229

Merged
dmcgowan merged 3 commits into
containerd:mainfrom
dmcgowan:fix-recv-deadlock
May 5, 2026
Merged

dmcgowan merged 3 commits into
containerd:mainfrom
dmcgowan:fix-recv-deadlock

Conversation

@dmcgowan

@dmcgowan dmcgowan commented Apr 1, 2026

Copy link
Copy Markdown
Member

Return error if stream backs up and does not get consumed to prevent head of line blocking on the connection deadlocking all streams.

This currently shows up if a client creates a stream and stops calling recv message before the receiving the close stream message.

Comment thread services.go
return nil
case <-s.ctx.Done():
return s.ctx.Err()
case <-time.After(time.Second):

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.

Timer leak pre-Go 1.23.

Comment thread stream.go
return nil
case <-ctx.Done():
return ctx.Err()
case <-time.After(time.Second):

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.

Same here.

dmcgowan added 3 commits May 1, 2026 16:14
Return error if stream backs up and does not get consumed to prevent
head of line blocking on the connection deadlocking all streams.

Signed-off-by: Derek McGowan <[email protected]>
In go 1.23, when a timer is abandoned it is immediately available for
GC. In prior versions, it was only available for GC after the timer
fired.

Signed-off-by: Derek McGowan <[email protected]>
@dmcgowan
dmcgowan force-pushed the fix-recv-deadlock branch from 3b6123e to cc8699e Compare May 1, 2026 23:15
@dmcgowan
dmcgowan merged commit 95e1509 into containerd:main May 5, 2026
11 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.

2 participants