-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: transport caches permanently broken persistent connections if write error happens during h2 handshake #34978
Comments
Does this reproduce with Go 1.13.3 (released yesterday)? #34498 seems like it may be related, and the fix for that was backported in 1.13.3. |
It reproduces on go1.13.3 and master. |
Is this a regression from 1.12? |
Yes, this is a new regression. This was broken by 43b9fcf which is present in: go1.13.3 go1.13.2 go1.13.1 go1.13 go1.13rc2 go1.13rc1 go1.13beta1. |
@fraenkel, could you take a look? I'll also try to look but it might still be in your head more than mine. |
@mikedanese, thanks! This is a great bug report. |
Change https://golang.org/cl/202078 mentions this issue: |
@gopherbot, please backport to Go 1.13. |
Backport issue(s) opened: #35087 (for 1.13). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://golang.org/wiki/MinorReleases. |
Change https://golang.org/cl/202642 mentions this issue: |
…r connections Fixes #35087 Updates #34978 Change-Id: I3baf1392ba7366ae6628889c47c343ef702ec438 Reviewed-on: https://go-review.googlesource.com/c/go/+/202078 Reviewed-by: Bryan C. Mills <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> (cherry picked from commit 88186e5) Reviewed-on: https://go-review.googlesource.com/c/go/+/202642 Reviewed-by: Emmanuel Odeke <[email protected]>
Reopening, as investigation into the test failures from this CL (#35113) aren't leaving me entirely happy yet. |
Change https://golang.org/cl/220905 mentions this issue: |
Copy of http://issuetracker.google.com/140973477 to github.
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?
Test case-ish is here:
https://gist.github.com/mikedanese/a9204f541d1b12740be2551e381b99fc
Trigger a connection write error after the TLS hanshake but during the h2 handshake.
What did you expect to see?
The persistent connection is not cached by http.Transport.
What did you see instead?
The persistent connection is cached by http.Transport.
More
This change appears to be the culprit:
43b9fcf
We noticed that a client can get into an state where it is consistently failing to make requests and dumping logs like:
While inspecting the process with strace, we noticed that it wasn't making any syscalls that would correspond to an outbound http request. We collected a core dump from the process and inspected it:
The core dump showed that http.Transport was holding onto one persistent connection with an alt http2erringRoundTripper that wrapped a failed write error. We successfully reproduced the behavior in the test case-ish linked above and saw that a failed write here:
go/src/net/http/h2_bundle.go
Lines 7157 to 7164 in 8d2ea29
Causes the h2 upgradeFn:
go/src/net/http/h2_bundle.go
Lines 6652 to 6656 in 8d2ea29
To return an http2erringRoundTripper. The persistent connection is cached by the transport storing the erring round tripper in pconn.alt. The erring round tripper is used in subsequent calls to:
go/src/net/http/transport.go
Lines 531 to 533 in 8d2ea29
And the pconn remains in the idle connection cache.
The text was updated successfully, but these errors were encountered: