]> Cypherpunks repositories - gostls13.git/commit
net/http: quiet useless warning during shutdown
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 11 Apr 2014 16:40:36 +0000 (09:40 -0700)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 11 Apr 2014 16:40:36 +0000 (09:40 -0700)
commit427a444f67544416a7e96b705a10b8be38269767
tree4790d6aaffbf8fdd62c4b52ab8d57e4889d6e02d
parenta599b4890a06486b1f888216ae87b4cbf3df418a
net/http: quiet useless warning during shutdown

What was happening on Issue 7010 was handler intentionally took 30
milliseconds and the proxy's client timeout was 35 milliseconds. Then it
slammed the proxy with a bunch of requests.

Sometimes the server would be too slow to respond in its 5 millisecond
window and the client code would cancel the request, force-closing the
persistConn.  If this came at the right time, the server's reply was
already in flight, and one of the goroutines would report:

Unsolicited response received on idle HTTP channel starting with "H"; err=<nil>

... rightfully scaring the user.

But the error was already handled and returned to the user, and this
connection knows it's been shut down. So look at the closed flag after
acquiring the same mutex guarding another field we were checking, and
don't complain if it's a known shutdown.

Also move closed down below the mutex which guards it.

Fixes #7010

LGTM=dsymonds
R=golang-codereviews, dsymonds
CC=adg, golang-codereviews, rsc
https://golang.org/cl/86740044
src/pkg/net/http/transport.go