Skip to content
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: TestServerShutdownStateNew is flaky #26233

Closed
mvdan opened this issue Jul 5, 2018 · 3 comments
Closed

net/http: TestServerShutdownStateNew is flaky #26233

mvdan opened this issue Jul 5, 2018 · 3 comments

Comments

@mvdan
Copy link
Member

@mvdan mvdan commented Jul 5, 2018

Two recent failures on linux-amd64-longtest:

https://build.golang.org/log/ef73c0ec3463104a804cba25d4b550a403db26b9
https://build.golang.org/log/6e2a1f6b524c1c8d2f794bce1bae272c87a62ef7

--- FAIL: TestServerShutdownStateNew (2.00s)
    serve_test.go:5603: shutdown too soon after 49.41µs
    serve_test.go:5617: timeout waiting for Read to unblock
FAIL
FAIL	net/http	37.294s

The test accepts shutdowns between 0.5x and 1.5x the expected amount, which is 5s. The result of not even a millisecond seems to point that the test completely breaks, as opposed to this being a timing issue. Looking into it.

/cc @bradfitz

@mvdan mvdan added this to the Go1.11 milestone Jul 5, 2018
@mvdan

This comment has been minimized.

Copy link
Member Author

@mvdan mvdan commented Jul 5, 2018

Very easy to reproduce with go test -c && stress -p 64 ./http.test -test.run TestServerShutdownStateNew. I get about 10% failures, with the "too soon" times being about 100-200µs.

@mvdan

This comment has been minimized.

Copy link
Member Author

@mvdan mvdan commented Jul 5, 2018

It seems like the issue is that, sometimes, Shutdown gets run before the server accepts the new connection. Then, the server returns ErrServerClosed imimediately, hence the shutdown returns almost immediately. I'll try to deflake this with ConnState, which should let us have the HTTP server notify the test when the connection has been accepted.

@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jul 5, 2018

Change https://golang.org/cl/122355 mentions this issue: net/http: deflake TestServerShutdownStateNew

@gopherbot gopherbot closed this in 96186a5 Jul 6, 2018
@golang golang locked and limited conversation to collaborators Jul 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.