Skip to content

fix(h2): reset a backend stream answered before its request was written - #1741

Merged
FlorentinDUBOIS merged 2 commits into
mainfrom
fix/h2-backend-early-response-slot
Oct 1, 2026
Merged

FlorentinDUBOIS merged 2 commits into
mainfrom
fix/h2-backend-early-response-slot

Conversation

@FlorentinDUBOIS

Copy link
Copy Markdown
Collaborator

ConnectionH2::end_stream skipped the RST_STREAM on a backend stream once the response's END_STREAM was read and the request was received whole, even when the rest of the request was still queued toward the backend. A backend that answered early (RFC 9113 §8.1) never saw END_STREAM and kept the stream half-closed, counting against its SETTINGS_MAX_CONCURRENT_STREAMS (§5.1.2) for the connection's lifetime.

The skip now also requires the request to have been handed to the output whole (front.is_completed()). Otherwise the stream is reset once with RST_STREAM(CANCEL).

  • Unit test: a_backend_stream_answered_before_its_request_was_written_is_cancelled
  • LIFECYCLE.md and CHANGELOG updated. Three pinned citations in doc/h2_mux_internals.md were repointed after the line shift.

Fixes #1734

@FlorentinDUBOIS
FlorentinDUBOIS force-pushed the fix/h2-backend-early-response-slot branch from 967b522 to b0cd491 Compare October 1, 2026 14:09
ConnectionH2::end_stream skipped the RST_STREAM on a backend stream once
the response's END_STREAM was read and the request was received whole,
even when the rest of the request was still queued toward the backend.
A backend that answered early (RFC 9113 §8.1) then never saw END_STREAM
and kept the stream half-closed, holding one of its
SETTINGS_MAX_CONCURRENT_STREAMS slots (§5.1.2) for the connection's
lifetime.

The skip now also requires the request to have been handed to the
output whole (front.is_completed()); otherwise the stream is reset once
with RST_STREAM(CANCEL).

Fixes #1734

Signed-off-by: Florentin Dubois <[email protected]>
@FlorentinDUBOIS
FlorentinDUBOIS force-pushed the fix/h2-backend-early-response-slot branch from b0cd491 to f6e7cb4 Compare October 1, 2026 19:08
@FlorentinDUBOIS
FlorentinDUBOIS merged commit 006d255 into main Oct 1, 2026
22 of 23 checks passed
FlorentinDUBOIS added a commit that referenced this pull request Oct 1, 2026
a_backend_stream_answered_before_its_request_was_written_is_cancelled,
added with #1741, withholds the backend's send window by setting
Stream::window to 0. This branch splits that field into front_window and
back_window, one per connection (RFC 9113 section 6.9), so after main was
merged in the test no longer compiled: the two changes touched different
lines and merged without a textual conflict.

The test drives the stream on its backend connection, whose send window
is now back_window (Stream::send_window_mut picks the leg from the
connection's Position). Set that leg to 0 so the request body still waits
behind its HEADERS, as the test intends.

Signed-off-by: Florentin Dubois <[email protected]>
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.

fix(h2): backend stream answered before its request was written is left open on the backend

1 participant