net/http: Server still handling new connections after Close (or Shutdown) returns #36093
Labels
Milestone
Comments
I can reproduce this reliably locally, but I have to increase the number of parallel requests to 10. After some more investigation, it does look like the handler is indeed invoked after we called server.Close(). I'm not an expert on I cannot reproduce this with net.Listen / Accept on my own, so I wonder if it is related to our retry semantics when accepting a connection in a http server. I'm stumped. /cc @bradfitz |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
In a loop I create a server with a unique ID, send requests to it and then close the server:
Test which reproduces this issue:
What did you expect to see?
Get requests always return the ID of the currently running server.
What did you see instead?
Get requests intermittently return the ID of the previously running server. This occurs even though the call to
Serve
has completed and the server has been closed.Other Notes
I noticed this problem when some of the integration tests I was running were spuriously failing if the same port was used multiple times. I narrowed it down to the server not actually being closed after
Close
orShutdown
returns so I created this issue.The text was updated successfully, but these errors were encountered: