-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/http2: setting Request.Close doesn't close TCP connections #49375
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 @tombergan |
Missed because our HTTP/2 tests for connection reuse call Sorry about that. |
I think there's a preexisting bug in here as well.
|
Change https://golang.org/cl/361498 mentions this issue: |
@gopherbot Please open backport issues for 1.16 and 1.17 |
Backport issue(s) opened: #49560 (for 1.16), #49561 (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/368375 mentions this issue: |
Change https://golang.org/cl/368374 mentions this issue: |
….Close is set Avoid reusing connections after receiving a response to a request for which cc.Close is set or a "Connection: close" header is present. Adjust the tests for connection reuse to test both the case where new conns are created by the http2 package and when they are created by the net/http package. For golang/go#49375 Fixes golang/go#49561 Change-Id: I58594972c832a20b66a3910c17acb51a98a9f7a5 Reviewed-on: https://go-review.googlesource.com/c/net/+/361498 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 69e39ba) Reviewed-on: https://go-review.googlesource.com/c/net/+/368375 Reviewed-by: Michael Knyszek <mknyszek@google.com>
….Close is set Avoid reusing connections after receiving a response to a request for which cc.Close is set or a "Connection: close" header is present. Adjust the tests for connection reuse to test both the case where new conns are created by the http2 package and when they are created by the net/http package. For golang/go#49375 Fixes golang/go#49560 Change-Id: I58594972c832a20b66a3910c17acb51a98a9f7a5 Reviewed-on: https://go-review.googlesource.com/c/net/+/361498 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 69e39ba) Reviewed-on: https://go-review.googlesource.com/c/net/+/368374 Reviewed-by: Michael Knyszek <mknyszek@google.com>
Avoid reusing connections after receiving a response to a request for which cc.Close is set or a "Connection: close" header is present. Adjust the tests for connection reuse to test both the case where new conns are created by the http2 package and when they are created by the net/http package. Fixes golang/go#49375 Change-Id: I58594972c832a20b66a3910c17acb51a98a9f7a5 Reviewed-on: https://go-review.googlesource.com/c/net/+/361498 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
….Close is set Avoid reusing connections after receiving a response to a request for which cc.Close is set or a "Connection: close" header is present. Adjust the tests for connection reuse to test both the case where new conns are created by the http2 package and when they are created by the net/http package. For golang/go#49375 Fixes golang/go#49561 Change-Id: I58594972c832a20b66a3910c17acb51a98a9f7a5 Reviewed-on: https://go-review.googlesource.com/c/net/+/361498 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 69e39bad7dc2bbb411fa35755c46020969029fa7) Reviewed-on: https://go-review.googlesource.com/c/net/+/368375 Reviewed-by: Michael Knyszek <mknyszek@google.com>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
go1.16.10, which is the latest release of go1.16, is affected.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
go run the source code below:
With go1.16.9, it outputs:
IP address lookup is done per request and connection is not reused. Note that connection is HTTP/2.
With go1.16.10, it outputs:
Notice that IP address lookup is done once and the connection is reused for the second request.
This contradicts the documentation of Request.Close:
If Transport.DisableKeepAlives is set to true, go1.16.10 does not reuse connection.
So go1.16.10 has a different behaviour between Transport.DisableKeepAlives and Request.Close.
What did you expect to see?
go1.16.10 should not reuse connection if Request.Close is set to true.
What did you see instead?
go1.16.10 reuses connection even if Request.Close is set to true.
The text was updated successfully, but these errors were encountered: