Skip to content

quic: fix reader backpressure deadlock on idle connections#63950

Open
pimterry wants to merge 2 commits into
nodejs:mainfrom
pimterry:fix-blocked-backpressure
Open

quic: fix reader backpressure deadlock on idle connections#63950
pimterry wants to merge 2 commits into
nodejs:mainfrom
pimterry:fix-blocked-backpressure

Conversation

@pimterry

Copy link
Copy Markdown
Member

When we're not reading from a QUIC stream, inbound data will build up until it hits the stream flow control window, and then the remote peer will stop sending until we're ready to continue.

When we're ready, we call session().ExtendStreamOffset (which calls ngtcp2_conn_extend_max_stream_offset) to send a MAX_STREAM_DATA frame to the peer expanding the window, telling them they can send us more.

Right now this doesn't always work: we call ExtendStreamOffset but that only queues the frame, it doesn't actually send it. This is masked in most cases by other activity on most sessions that ends up sending the frame with it implicitly (most commonly acks).

If you ever have an idle session though, and then you read a stream that's been blocked like this, the frame will never be sent, which deadlocks: you're waiting for more data, and the remote peer is waiting to be told it's allowed to send some.

This PR fixes that, by ensuring we always flush a send after we update the stream window.

Signed-off-by: Tim Perry <pimterry@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3. labels Jun 16, 2026
Comment thread test/parallel/test-quic-stream-read-after-blocked.mjs Outdated
Comment thread src/quic/streams.cc Outdated
Co-authored-by: James M Snell <jasnell@gmail.com>
Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
@pimterry pimterry added the commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. label Jun 17, 2026
@pimterry

Copy link
Copy Markdown
Member Author

Suggestions applied, thanks both! I'll need a quick rereview when somebody has a sec please.

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants