x/net/http2: data race in onSameConn test helper #37505
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
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: