Skip to content

fixed lost stream send request when a flow control update races with queueing it - #96

Merged
ptrd merged 1 commit into
ptrd:masterfrom
harrharr:stream-send-request-race
Oct 17, 2026
Merged

ptrd merged 1 commit into
ptrd:masterfrom
harrharr:stream-send-request-race

Conversation

@harrharr

Copy link
Copy Markdown
Contributor

Hi Peter,
we encountered a stalled write (KWIK 0.12) in our tests and Claude found a possible race:

The send request was counted only after it had been queued. If the sender thread executed it in between (finding the stream blocked by flow control) and the receiver thread processed the MAX_STREAM_DATA right then, streamNotBlocked saw a count of -1 and queued nothing: the stream never sent again and the writer blocked forever on the full send buffer.

…queueing it

The send request was counted only after it had been queued. If the sender
thread executed it in between (finding the stream blocked by flow control)
and the receiver thread processed the MAX_STREAM_DATA right then,
streamNotBlocked saw a count of -1 and queued nothing: the stream never
sent again and the writer blocked forever on the full send buffer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ptrd

ptrd commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Thanks! This also fixes #91 ;-).

@ptrd
ptrd merged commit 636bb98 into ptrd:master Oct 17, 2026
1 check 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