Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http,x/net/http2: HTTP/2 RoundTrip does not close request body if ClientConnPool's GetClientConn fails #61257

Open
alex-negret opened this issue Jul 10, 2023 · 4 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@alex-negret
Copy link

The RoundTrip contract states that the request body should be closed by RoundTrip, even when an error occurs.
https://pkg.go.dev/net/http#RoundTripper

The HTTP/2 RoundTrip / RoundTripOpt does not close the request body, if its client connection pool cannot acquire a connection (see transport.go#557).

@bcmills
Copy link
Contributor

bcmills commented Jul 10, 2023

(attn @neild)

@bcmills bcmills added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 10, 2023
@bcmills bcmills changed the title x/net/http2: RoundTrip does not close request body if ClientConnPool's GetClientConn fails net/http,x/net/http2: HTTP/2 RoundTrip does not close request body if ClientConnPool's GetClientConn fails Jul 10, 2023
@bcmills bcmills added this to the Backlog milestone Jul 10, 2023
@bcmills
Copy link
Contributor

bcmills commented Jul 10, 2023

@alex-negret, would you like to try contributing a fix? (I know net/http and x/net/http2 are pretty difficult to follow in general, but in this case it seems like the hardest part will be writing a regression test.)

@gopherbot
Copy link

Change https://go.dev/cl/508399 mentions this issue: net/http,x/net/http2: close request body in HTTP/2 RoundTrip if GetClientConn fails

@neganovalexey
Copy link
Contributor

I've tried to fix this within HTTP/2-specific code. However, I had to make an exception from the rule in order not to break current net/http behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants