-
Notifications
You must be signed in to change notification settings - Fork 18k
x/net/http2: data race in onSameConn test helper #37505
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
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Testing
An issue that has been verified to require only test changes, not just a test failure.
Milestone
Comments
Change https://golang.org/cl/304829 mentions this issue: |
Change https://golang.org/cl/367516 mentions this issue: |
gopherbot
pushed a commit
that referenced
this issue
Dec 1, 2021
Ensure that user ConnState callbacks have completed before returning from (*httptest.Server).Close. Fixes: #49851 Updates: #37510 Updates: #37505 Updates: #45237 Change-Id: I8fe7baa089fbe4f3836bf6ae9767c7b1270d1331 Reviewed-on: https://go-review.googlesource.com/c/go/+/304829 Trust: Damien Neil <dneil@google.com> Run-TryBot: Damien Neil <dneil@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit 5cec8b8) Reviewed-on: https://go-review.googlesource.com/c/go/+/367516 Trust: Bryan C. Mills <bcmills@google.com> Run-TryBot: Bryan C. Mills <bcmills@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Damien Neil <dneil@google.com>
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Testing
An issue that has been verified to require only test changes, not just a test failure.
https://build.golang.org/log/0d66aaa201ea31f6aa29c94ff8d6b76f67789071
The racing write is here:
go/src/testing/testing.go
Lines 976 to 978 in 7bb3317
That comment suggests that the bug lies in the test itself:
https://github.com/golang/net/blob/0de0cce0169b09b364e001f108dc0399ea8630b3/http2/transport_test.go#L193-L198
That, in turn, suggests that the
serverTester
is continuing to execute one of its callbacks after itsClose
method has already returned.The callback is registered via the
httptest.Server
'sConfig.ConnState
field:https://github.com/golang/net/blob/0de0cce0169b09b364e001f108dc0399ea8630b3/http2/server_test.go#L118-L119
The
(*serverTester).Close
method explicitly closes itshttptest.Server
and itsnet.Conn
.https://github.com/golang/net/blob/0de0cce0169b09b364e001f108dc0399ea8630b3/http2/server_test.go#L256-L259
The documentation for
(*httptest.Server).Close
says that it “blocks until all outstanding requests on this server have completed.” However, it does not specify whether it blocks until the corresponding connections have been closed.I would argue that
(*httptest.Server).Close
should block until the outstanding connections are completely closed, including anyConnState
callbacks. However, there may be a shorter-term workaround we can apply in thex/net/http2
test in the interim. (I will file a separate issue forhttptest.Server
.)CC @bradfitz @rsc @tombergan
The text was updated successfully, but these errors were encountered: