net: Listener.Close() does not fully stop the server when Accept()'ing at the same time #22502
Labels
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?go version go1.9.2 linux/amd64
Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?What did you do?
Run this:
What did you expect to see?
I expected the
listener.Close
call to fully stop the server in every iteration. No failures.What did you see instead?
When you
listener.Accept
in another goroutine, theClose
call doesn't always complete in time and the server stays alive. This is especially annoying for writing tests where each test opens a new server and closes it viadefer
. Some tests can't start the server because the server from the previous test hasn't been killed yet.References:
https://github.com/blitzprog/go-tests/blob/master/net-listener-close/net-listener-close.go
https://github.com/aerogo/nano
The text was updated successfully, but these errors were encountered: