net/http/httputil: request may be killed by mistake by former cancel request in ReverseProxy.ServeHTTP #16041
Labels
FrozenDueToAge
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
Hi:
What version of Go are you using (
go version
)?What operating system and processor architecture are you using (
go env
)?What did you do?
What did you expect to see?
What did you see instead?
Finally I find this:
There is a goroutine here(in ServeHTTP): goroutine
this goroutine is used for receiving
clientGone
orreqDone
signal, however, we assume this scene:ServeHTTP
start handlingRequest A
(using underlyingnet.Conn C
)Request A
was canceled by its client (sending sig toclientGone
)use of closed network connection
in go1.6- or other error in go1.6+)ServeHTTP
start to return and defer close(reqDone) is executed(close is non-block, soServeHTTP
may be return before thegoroutine A
receive close signal, butgoroutine A
is still alive)net/http
putnet.Conn C
to IdleConnRequest B
arrived andnet/http
pick the same underlyingnet.Conn C
ServeHTTP
start handlingRequest B
(using the same underlyingnet.Conn C
)goroutine A
got signalclientGone
first, and then doCancelRequest
which will closenet.Conn C
Request B
's RoundTrip return error cause its underlying conn is closedThe text was updated successfully, but these errors were encountered: