-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/httptest: race on Server.Close and long-running requests #12262
Comments
(This is in Go 1.5) |
CC @bradfitz |
Also seeing this in 1.4.2 and 1.5.1 Edit: this code seems to reproduce it fairly reliably on my system:
|
Can somebody who was able to reproduce this reliably before (@jmhodges, @phemmer?) try it again with Go tip. I think this might've been fixed by:
|
I can't get a race with either example with tip, but I do with Go 1.5. So yeah, looks like this was fixed. |
@bradfitz - Was this also fixed in Go 1.5.2 by any chance? |
No. Point releases are only for critical crashes or security things. |
Thanks. |
golang/go#12262 . See kubernetes#19254 for more details. This change should be reverted when we upgrade to Go 1.6.
Disable closing of the httptest Server due to golang/go#12262
golang/go#12262 . See kubernetes#19254 for more details. This change should be reverted when we upgrade to Go 1.6.
Reliably reproducible on two up-to-date Fedora 23 machines using go 1.5.3, both one Core i7-4770R and a Core i7-4790. golang/go#12262
golang/go#12262 . See #19254 for more details. This change should be reverted when we upgrade to Go 1.6.
httptest.Server races between requests coming into its mux, and Server.Close. Normal usage doesn't typically trigger the race detector, but when a test client timeouts (we do this intentionally in letsencrypt/boulder to test how boulder fails) and moves on to teardown the test with Close, a race is found easily.
This code has a client that always times out when making a request to the server and reliably has a race detected: https://play.golang.org/p/aC0YTPBYGn
This is its output when run with the race detector:
It seems the race detector is saying that between Server.Close closing the listener and Server.Close calling WaitGroup.Wait, a new Request could be pulled off the listener, but that the new Request could then only get to waitGroupHandler.ServeHTTP's WaitGroup.Add after the Wait is called.
The text was updated successfully, but these errors were encountered: