x/net/http2: singleUse ClientConn with AllowHTTP transport is always unusable #61863
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Create an HTTP2 transport with AllowHTTP = true, and try to send a request using it with req.Close = true. This will hang until the internal retry mechanism in the HTTP2 roundtrip ends after exponential backoff.
https://go.dev/play/p/KhmQcQB0PPD
If you remove req.Close = true, in my contrived example you get unexpected EOF, but the point is no timeout, because its not retrying aimlessly.
What did you expect to see?
I would expect the transport to understand that AllowHTTP=true setting nextStreamID to 3 in the newClientConn() function does not mean it should be considered "not usable" before it ever makes a request.
What did you see instead?
The issue is because of this line that sets nextStreamID to 3 before a request is ever made, and then this line that interprets a nextStreamID higher than 1 as having been "used".
I'm not sure my use case for this is exactly "up to standard" but it seems like the behavior is unintentional - the connection should be usable once even if AllowHTTP was set on its creation, and at least it shouldn't retry exponentially when there's no way it could get a different outcome in the next iteration.
Thanks for reading!
The text was updated successfully, but these errors were encountered: