[go] net/http: fix WaitGroup race in TestTransportNoReuseAfterEarlyResponse

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Feb 6, 2026, 5:53:35 PM (2 days ago) Feb 6
to Dmitri Shuralyov, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Damien Neil, Dmitri Shuralyov, Go LUCI, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
net/http: fix WaitGroup race in TestTransportNoReuseAfterEarlyResponse

The remaining race reported in go.dev/issue/66519 is that it's possible
for copying.Wait to start running before all copying.Add calls complete.
It happens infrequently as is, but padding both Wait and Add calls with
a 100 ms sleep makes it highly reproducible.

Arranging the Add call to happen before responding "foo" to the POST
request should be enough to guarantee that Wait doesn't start running
until all Add calls have already happened.

While here, delete a blank line that gets more in the way of reading
error handling code than it helps.

For #64252.
Fixes #66519 (optimistically).
Change-Id: Ibf264d8cc5ffc2495e8ae8e66a15591310c65e71
Reviewed-by: Dmitri Shuralyov <dmit...@google.com>
Reviewed-by: Damien Neil <dn...@google.com>
Auto-Submit: Dmitri Shuralyov <dmit...@golang.org>
Files:
  • M src/net/http/client_test.go
  • M src/net/http/transport_test.go
Change size: S
Delta: 2 files changed, 5 insertions(+), 6 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Damien Neil, +1 by Dmitri Shuralyov
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: Ibf264d8cc5ffc2495e8ae8e66a15591310c65e71
Gerrit-Change-Number: 739060
Gerrit-PatchSet: 3
Gerrit-Owner: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Damien Neil <dn...@google.com>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@golang.org>
Gerrit-Reviewer: Dmitri Shuralyov <dmit...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages