Repository navigation
http2: return flow control for response data of a canceled request - #278
Open
cristiangirlea wants to merge 1 commit into
Open
cristiangirlea wants to merge 1 commit into
cristiangirlea wants to merge 1 commit into
Conversation
When a request is canceled while RoundTrip waits for the response headers, its stream stays registered until the request's cleanup forgets it. Response data arriving in between is charged to the connection window and buffered for a body nobody will read, and nothing returns it. Each canceled request that races with its response leaks the data it received, until the window is used up and every response on the connection stalls after its headers. Discard the buffered data and return its flow control when RoundTrip gives up on a stream, as closing an unread response body does, and stop buffering data that arrives afterwards so that it is returned on receipt. The refund now happens once per stream, so closing a response body twice no longer returns its unread data twice. This is the backport of the equivalent fix in std. For golang/go#82677
Contributor
|
This PR (HEAD: c930f47) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/862422. Important tips:
|
cristiangirlea
marked this pull request as ready for review
November 20, 2026 12:22
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a request is canceled while RoundTrip waits for the response
headers, its stream stays registered until the request's cleanup
forgets it. Response data arriving in between is charged to the
connection window and buffered for a body nobody will read, and nothing
returns it. Each canceled request that races with its response leaks
the data it received, until the window is used up and every response
on the connection stalls after its headers.
Discard the buffered data and return its flow control when RoundTrip
gives up on a stream, as closing an unread response body does, and stop
buffering data that arrives afterwards so that it is returned on
receipt. The refund now happens once per stream, so closing a response
body twice no longer returns its unread data twice.
This is the backport of the equivalent fix in std.
For golang/go#82677