net/http: Server.Close may not able to close all connections #48642
I encountered lingering connection after calling Server.Close and it's not closed by Server.Close
Here is reproducible example: https://play.golang.org/p/9aLVDwWPQhH
The problem is http/server.go: Server.Serve function didn't check if Server is already closed before calling handler, and if Server.Close been called after l.Accept return but before c.setState(c.rwc, StateNew, runHooks), the new connection is not registered in the activeConn map when Server.Close try to close all connections.
The example code simulate this condition by sleep one second during ConnContext call. Program can exit corrected if this sleep is removed.
The text was updated successfully, but these errors were encountered: