-
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