• Brad Fitzpatrick's avatar
    net/http: quiet useless warning during shutdown · 427a444f
    Brad Fitzpatrick authored
    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
    427a444f
Name
Last commit
Last update
api Loading commit data...
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...