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: HTTP/2 connections incorrectly marked as "reused" #60636

Open
neild opened this issue Jun 6, 2023 · 1 comment
Open

net/http: HTTP/2 connections incorrectly marked as "reused" #60636

neild opened this issue Jun 6, 2023 · 1 comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@neild
Copy link
Contributor

neild commented Jun 6, 2023

The Transport retry loop checks to see if a request was sent on a fresh connection or a reused one (persistConn.shouldRetryRequest). Requests sent on a fresh connection are not retried, to avoid looping forever if the server is hanging up on the request for some reason.

Connections are marked as reused when added to the idle conn pool (Transport.tryPutIdleConn).

HTTP/2 connections are added to the idle conn pool as soon as they're made, since the connection can be reused for additional HTTP/2 requests while the first is in flight.

Thus, we incorrectly retry requests to an HTTP/2 server that hangs up without giving a response (say, because we sent a malformed request), because HTTP/2 connections are always marked as "reused".

@neild
Copy link
Contributor Author

neild commented Jun 6, 2023

...also, the HTTP/2 side has its own competing retry loop which doesn't apply the "don't retry if the first request on a connection fails" heuristic, so fixing this only on the net/http side is insufficient.

@dr2chase dr2chase added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 6, 2023
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

2 participants