go/src
Daniel Martí 96186a58e3 net/http: deflake TestServerShutdownStateNew
This function tests that calling Shutdown on a Server that has a "new"
connection yet to write any bytes, in which case it should wait for five
seconds until considering the connection as "idle".

However, the test was flaky. If Shutdown happened to run before the
server accepted the connection, the connection would immediately be
rejected as the server is already closed, as opposed to being accepted
in the "new" state. Then, Shutdown would return almost immediately, as
it had no connections to wait for:

	--- FAIL: TestServerShutdownStateNew (2.00s)
	    serve_test.go:5603: shutdown too soon after 49.41µs
	    serve_test.go:5617: timeout waiting for Read to unblock

Fix this by making sure that the connection has been accepted before
calling Shutdown. Verified that the flake is gone after 50k concurrent
runs of the test with no failures, whereas the test used to fail around
10% of the time on my laptop:

	go test -c && stress -p 256 ./http.test -test.run TestServerShutdownStateNew

Fixes #26233.

Change-Id: I819d7eedb67c48839313427675facb39d9c17257
Reviewed-on: https://go-review.googlesource.com/122355
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-07-06 02:13:27 +00:00
..
archive archive/zip: warn about FileHeader.Name being unvalidated on read 2018-06-13 21:57:41 +00:00
bufio bufio: clarify SplitFunc docs for nil token 2018-06-13 21:43:06 +00:00
builtin
bytes bytes, strings: fix comparison of long byte slices on s390x 2018-06-29 20:48:07 +00:00
cmd cmd/internal/obj/s390x: increase maximum number of loop iterations 2018-07-05 07:21:50 +00:00
compress
container
context context: add docs to ExampleWithValue 2018-06-12 22:33:54 +00:00
crypto crypto/x509: better debug output for verify-cert calls 2018-06-28 02:46:18 +00:00
database/sql
debug debug/elf,macho,pe: support compressed DWARF 2018-06-19 22:13:51 +00:00
encoding encoding/gob: correct issue number typo in comment 2018-06-13 05:33:59 +00:00
errors
expvar
flag flag: add a Value example 2018-06-21 23:32:53 +00:00
fmt
go go/doc: make examples that depend on top-level decls playable 2018-06-27 23:20:51 +00:00
hash
html text/template/parse: undo breaking API changes 2018-06-22 08:05:11 +00:00
image
index/suffixarray
internal bytes, strings: fix comparison of long byte slices on s390x 2018-06-29 20:48:07 +00:00
io
log
math math/big: handle negative exponents in Exp 2018-06-14 22:26:30 +00:00
mime mime/quotedprintable: accept bytes >= 0x80 2018-06-27 17:00:08 +00:00
net net/http: deflake TestServerShutdownStateNew 2018-07-06 02:13:27 +00:00
os os: treat "${}" in Expand like in Go 1.10 2018-06-29 21:07:28 +00:00
path
plugin
reflect reflect: remove struct tags from unexported types 2018-06-28 23:06:00 +00:00
regexp regexp: examples for Regexp.FindIndex and Regexp.FindAllSubmatchIndex methods 2018-06-30 01:04:30 +00:00
runtime runtime: support capturing C backtrace from signal handler on darwin/amd64 2018-07-04 00:18:48 +00:00
sort
strconv strconv: add missing period to godoc comment 2018-06-09 01:26:25 +00:00
strings strings: do much less redundant testing in TestCompareStrings 2018-07-02 14:39:29 +00:00
sync sync: fix deficiency in RWMutex race annotations 2018-06-22 14:43:09 +00:00
syscall misc/wasm: use single map for string, symbol and object id mapping. 2018-07-03 20:45:17 +00:00
testing testing/cover: improve comments on CoverBlock 2018-07-01 08:07:47 +00:00
text text/template/parse: fix a comment around the assign operator 2018-06-28 19:37:15 +00:00
time time: clarify Unix, UnixNano, and In a bit 2018-06-29 23:01:49 +00:00
unicode unicode: fix SpecialCase to follow its docs & respect explict no-op mappings 2018-06-17 08:48:39 +00:00
unsafe
vendor/golang_org/x
Make.dist
all.bash
all.bat
all.rc
androidtest.bash
bootstrap.bash
buildall.bash
clean.bash
clean.bat
clean.rc
cmp.bash
iostest.bash
make.bash make.bash: don't pass GOOS and GOARCH to cmd/go when finding GOROOT_BOOTSTRAP 2018-06-20 16:04:33 +00:00
make.bat
make.rc
naclmake.bash
nacltest.bash
race.bash runtime/race: implement race detector for ppc64le 2018-06-11 17:45:36 +00:00
race.bat
run.bash
run.bat
run.rc