You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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, the Close 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 via defer. Some tests can't start the server because the server from the previous test hasn't been killed yet.
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: