]> Cypherpunks repositories - gostls13.git/commit
net/http: wait forever for write results in tests
authorDamien Neil <dneil@google.com>
Fri, 7 Apr 2023 17:04:42 +0000 (10:04 -0700)
committerDamien Neil <dneil@google.com>
Fri, 7 Apr 2023 18:08:14 +0000 (18:08 +0000)
commit1444c0b01e4f83a90f0d97b3bf0b346290ec02e3
tree061deec5888e005a3418755ca6baa2a738706012
parent38dadcc3b5e0f0ed70d224f1eb519a83dcdb52de
net/http: wait forever for write results in tests

After performing a round trip on a connection, the connection is
usually returned to the idle connection pool. If the write of the
request did not complete successfully, the connection is not
returned.

It is possible for the response to be read before the write
goroutine has finished signalling that its write has completed.
To allow for this, the check to see if the write completed successfully
waits for 50ms for the write goroutine to report the result of the
write.

See comments in persistConn.wroteRequest for more details.

On a slow builder, it is possible for the write goroutine to take
longer than 50ms to report the status of its write, leading to test
flakiness when successive requests unexpectedly use different connections.

Set the timeout for waiting for the writer to an effectively
infinite duration in tests.

Fixes #51147
Fixes #56275
Fixes #56419
Fixes #56577
Fixes #57375
Fixes #57417
Fixes #57476
Fixes #57604
Fixes #57605

Change-Id: I5e92ffd66b676f3f976d8832c0910f27456a6991
Reviewed-on: https://go-review.googlesource.com/c/go/+/483116
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
src/net/http/export_test.go
src/net/http/main_test.go
src/net/http/transport.go
src/net/http/transport_test.go