Closed kornel661 closed 9 years ago
Given the change in your pull request, I think we can eliminate the sleeps in the test helper. Thanks!
Turns out we can't -- the change in the PR breaks the test. I'll leave this issue open until we've fixed this.
This has been fixed as part of the rewrite.
It seems to me that line 40
should be moved to the end of the function to avoid a race condition between:
exited=true
) andif exited {...
I'm aware that this test runs only on one thread and the handler takes quite long to complete (so the race is highly unlikely), but I believe that the Go memory model makes this change mandatory (to get correct, predictable results according to the language semantics).
Another race is in the
TestShutdown
. Concurrent execution may lead to a situation where the server is still running but the other goroutine went ahead and successfully connected.