-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
Comments
...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 |
Change https://go.dev/cl/576895 mentions this issue: |
Change https://go.dev/cl/576976 mentions this issue: |
Pull in CL 576895: ec05fdcd http2: don't retry the first request on a connection on GOAWAY error For #66668. Fixes #60636. Change-Id: I9903607e3d432a5db0325da82eb7f4b378fbddde Reviewed-on: https://go-review.googlesource.com/c/go/+/576976 Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Damien Neil <dneil@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
As i known, this issue will affect go1.22 and go1.21. why not backport this to these old version? thanks. |
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".
The text was updated successfully, but these errors were encountered: