-
Notifications
You must be signed in to change notification settings - Fork 18.1k
net/http: Possible HTTP/2 busy loop regression in Go 1.17.3 #49615
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
Comments
cc @neild |
We have found a reproducer, please find attached. It is related to some of the settings on the |
Change https://golang.org/cl/364574 mentions this issue: |
Thats an unpleasant bug. Thanks for the nice analysis. |
@gopherbot Please open backport issues for 1.16 and 1.17. |
Backport issue(s) opened: #49623 (for 1.16), #49624 (for 1.17). 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/368377 mentions this issue: |
Change https://golang.org/cl/368376 mentions this issue: |
…eaderTimeout is set Don't keep reading from respHeaderRecv after the response headers are received. For golang/go#49615. Fixes golang/go#49624. Change-Id: Ib8126c954930011ac09b2cbc70bbbce76531b7db Reviewed-on: https://go-review.googlesource.com/c/net/+/364574 Trust: Damien Neil <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit 47ca1ff) Reviewed-on: https://go-review.googlesource.com/c/net/+/368377 Reviewed-by: Michael Knyszek <[email protected]>
…eaderTimeout is set Don't keep reading from respHeaderRecv after the response headers are received. For golang/go#49615. Fixes golang/go#49623. Change-Id: Ib8126c954930011ac09b2cbc70bbbce76531b7db Reviewed-on: https://go-review.googlesource.com/c/net/+/364574 Trust: Damien Neil <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit 47ca1ff) Reviewed-on: https://go-review.googlesource.com/c/net/+/368376 Reviewed-by: Michael Knyszek <[email protected]>
Don't keep reading from respHeaderRecv after the response headers are received. Fixes golang/go#49615. Change-Id: Ib8126c954930011ac09b2cbc70bbbce76531b7db Reviewed-on: https://go-review.googlesource.com/c/net/+/364574 Trust: Damien Neil <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
…eaderTimeout is set Don't keep reading from respHeaderRecv after the response headers are received. For golang/go#49615. Fixes golang/go#49624. Change-Id: Ib8126c954930011ac09b2cbc70bbbce76531b7db Reviewed-on: https://go-review.googlesource.com/c/net/+/364574 Trust: Damien Neil <[email protected]> Run-TryBot: Damien Neil <[email protected]> TryBot-Result: Go Bot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]> (cherry picked from commit 47ca1ff31462b4c8e280b5f2cdba5050aa61e890) Reviewed-on: https://go-review.googlesource.com/c/net/+/368377 Reviewed-by: Michael Knyszek <[email protected]>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Go 1.17.3 is currently the latest release. The same binary compiled with Go 1.17.2 does not have the same issue.
What operating system and processor architecture are you using (
go env
)?go env
OutputThe issue
Wtih some of our production binaries, we have seen quiescent CPU usages between 67%–100% of one core, even though the binary is idle. We have not yet found a small reproducer. This issue was found on binaries that were recompiled without changes (i.e. identical source, identical
go.mod
) with Go 1.17.3 — it does not occur if we compile the same input with Go 1.17.2 or any earlier version that we have used.Looking at pprof we see:

pprof.human-attribute-server.samples.cpu.003.pb.gz
Looking at the update to the HTTP/2 bundle in Go1.17.3, we see a new
func (cs *http2clientStream) writeRequest
which has the following loop at the end:The line number of this in
h2_bundle.go
matches the line number in the profile.Without knowing much at all about the design or operation of the HTTP/2 code, it would seem that if the channel
respHeaderRecv
(which is earlier set tocs.respHeaderRecv
) is closed, that this function would busy-wait. And indeed, the CL updating the bundle in Go 1.17.3 does introduce a newclose(cs.respHeaderRecv)
on line 8692. I'm not 100% clear if that is the issue, but it's as far as I got without familiarising myself with the HTTP/2 codebase.The text was updated successfully, but these errors were encountered: