Skip to content

h2: give back connection credit in the callback, as h2v2 does - #34

Merged
pgit merged 1 commit into
masterfrom
h2-no-server-push
Nov 3, 2026
Merged

pgit merged 1 commit into
masterfrom
h2-no-server-push

Conversation

@pgit

@pgit pgit commented Nov 3, 2026

Copy link
Copy Markdown
Owner

on_data_chunk_recv_callback() left that to NGHttp2Stream::on_data(), so DATA without a stream never got it back: with 1.35 MB of it forced through, the client ended the connection with FLOW_CONTROL_ERROR after 1 MB. Now the callback does it, with or without a stream.

No peer can get there as it is. streams_ loses an entry only after nghttp2 has closed the stream, and then nghttp2 does not deliver the data, so there is no test for this: it would take a hook to remove a live stream from the session. It took a temporary patch to measure this, too.

Both backends now have the same shape. For h2v2, that adds the start_write() its branch without a stream did not have, which could leave the WINDOW_UPDATE waiting for something else to wake up the send loop. on_data() of h2 lost the arguments it only needed for this, and now has the signature of the one of h2v2.

on_data_chunk_recv_callback() left that to NGHttp2Stream::on_data(), so DATA without a stream never
got it back: with 1.35 MB of it forced through, the client ended the connection with
FLOW_CONTROL_ERROR after 1 MB. Now the callback does it, with or without a stream.

No peer can get there as it is. streams_ loses an entry only after nghttp2 has closed the stream, and
then nghttp2 does not deliver the data, so there is no test for this: it would take a hook to remove a
live stream from the session. It took a temporary patch to measure this, too.

Both backends now have the same shape. For h2v2, that adds the start_write() its branch without a
stream did not have, which could leave the WINDOW_UPDATE waiting for something else to wake up the
send loop. on_data() of h2 lost the arguments it only needed for this, and now has the signature of
the one of h2v2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pgit
pgit merged commit cc3faee into master Nov 3, 2026
11 checks passed
@pgit
pgit deleted the h2-no-server-push branch November 4, 2026 18:49
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.

1 participant