1
0
mirror of https://github.com/golang/go synced 2024-10-03 00:21:22 -06:00
go/src
Daniel Morsing 39377013cb net/http: handle close/response race more gracefully
There was a logical race in Transport.RoundTrip where a roundtrip with
a pending response would race with the channel for the connection
closing. This usually happened for responses with connection: close
and no body.

We handled this race by reading the close channel, setting a timer
for 100ms and if no response was returned before then, we would then
return an error.

This put a lower bound on how fast a connection could fail. We couldn't
fail a request faster than 100ms.

Reordering the channel operations gets rid of the logical race. If
the readLoop causes the connection to be closed, it would have put
its response into the return channel already and we can fetch it with
a non-blocking receive.

Change-Id: Idf09e48d7a0453d7de0120d3055d0ce5893a5428
Reviewed-on: https://go-review.googlesource.com/1787
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2015-04-09 13:46:50 +00:00
..
archive all: use "reports whether" in place of "returns true if(f)" 2015-03-18 15:14:06 +00:00
bufio bufio: fix incorrect comment on Scanner.Scan 2015-03-18 00:59:49 +00:00
builtin
bytes bytes, strings: add Reader.Size methods 2015-04-06 08:53:47 +00:00
cmd cmd/go: detect which VCS to use with Bitbucket when the API call fails. 2015-04-09 09:57:12 +00:00
compress compress/flate: fix typo in comment 2015-04-01 16:48:04 +00:00
container
crypto crypto/tls: tidy up a little and add test. 2015-04-04 00:06:21 +00:00
database/sql database/sql: Retry with a fresh connection after maxBadConnRetries 2015-04-08 16:18:36 +00:00
debug debug/dwarf, encoding/asn1, go/ast: fix old comments 2015-03-24 00:09:30 +00:00
encoding encoding/gob: clean up decoderMap after errBadType 2015-04-08 21:28:24 +00:00
errors
expvar
flag all: use "reports whether" in place of "returns true if(f)" 2015-03-18 15:14:06 +00:00
fmt fmt: improve test coverage of %x and %X format variations for strings 2015-04-01 00:55:30 +00:00
go go/types/internal/gcimporter: update for 7g and 9g 2015-04-08 17:55:51 +00:00
hash os/signal, hash/crc32: add arm64 build tags 2015-03-16 18:46:43 +00:00
html text/template: provide a mechanism for options 2015-04-03 23:40:59 +00:00
image image/jpeg: reject multiple Start-Of-Frame markers. 2015-04-09 02:32:23 +00:00
index/suffixarray
internal os: windows Rename should overwrite destination file. 2015-04-09 08:39:52 +00:00
io io: clarify Copy docs regarding error handling 2015-04-08 13:39:33 +00:00
log log/syslog: avoid unix sockets on darwin/arm 2015-03-04 22:13:06 +00:00
math math/big: make ErrNaN actually implement the error interface (oversight) 2015-04-08 19:47:39 +00:00
mime mime/quotedprintable: add binary mode to the writer 2015-03-30 12:49:19 +00:00
net net/http: handle close/response race more gracefully 2015-04-09 13:46:50 +00:00
os os: windows Rename should overwrite destination file. 2015-04-09 08:39:52 +00:00
path all: fix race when allocating buffer for some windows syscalls 2015-04-08 02:06:31 +00:00
reflect all: use "reports whether" in place of "returns true if(f)" 2015-03-18 15:14:06 +00:00
regexp regexp: skip backtracker for long programs 2015-04-09 09:38:23 +00:00
runtime runtime: make windows exception handler code arch independent 2015-04-09 09:55:38 +00:00
sort
strconv all: use "reports whether" in place of "returns true if(f)" 2015-03-18 15:14:06 +00:00
strings bytes, strings: add Reader.Size methods 2015-04-06 08:53:47 +00:00
sync sync/atomic: add support for GOARCH=arm64 2015-03-16 18:46:18 +00:00
syscall all: fix race when allocating buffer for some windows syscalls 2015-04-08 02:06:31 +00:00
testing testing/quick: fix comment 2015-03-27 13:00:53 +00:00
text text/template: provide a mechanism for options 2015-04-03 23:40:59 +00:00
time time: unify formatting of decimals for timestamps 2015-04-08 16:17:22 +00:00
unicode all: use "reports whether" in place of "returns true if(f)" 2015-03-18 15:14:06 +00:00
unsafe
all.bash
all.bat
all.rc
androidtest.bash androidtest.bash: copy pkg for gcimporter tests 2015-04-08 14:39:07 +00:00
bootstrap.bash build: add bootstrap.bash for bootstrapping new systems 2015-03-02 17:51:56 +00:00
clean.bash
clean.bat
clean.rc
iostest.bash iostest.bash: warn if GOARCH is not correct 2015-04-03 18:51:42 +00:00
make.bash [dev.cc] cmd/go: fix expansion of 'std', add 'cmd' 2015-02-23 15:13:17 +00:00
make.bat build: update Windows make.bat to use CC_FOR_TARGET. 2015-03-02 02:20:46 +00:00
Make.dist
make.rc all: delete C libraries and cmd/dist code that builds them 2015-03-01 00:40:23 +00:00
nacltest.bash nacltest.bash: reduce test time by using bootstrapping Go to build fstest_nacl.go 2015-03-24 23:58:14 +00:00
race.bash [dev.cc] cmd/go: fix expansion of 'std', add 'cmd' 2015-02-23 15:13:17 +00:00
race.bat [dev.cc] cmd/go: fix expansion of 'std', add 'cmd' 2015-02-23 15:13:17 +00:00
run.bash build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
run.bat build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00
run.rc build: convert run.bash, run.bat, and run.rc into a Go program 2015-03-03 23:22:11 +00:00