]> Cypherpunks.ru repositories - gostls13.git/commit
net/http: synchronize tests that use reqNum counters
authorBryan C. Mills <bcmills@google.com>
Thu, 14 Sep 2023 13:03:37 +0000 (09:03 -0400)
committerGopher Robot <gobot@golang.org>
Thu, 14 Sep 2023 17:45:18 +0000 (17:45 +0000)
commit09300d89e94da7b1f32742e80768acc711b5c590
tree277ebdf43bb4d0b6a1a57e62cc42664a35427305
parent65c53a1833a26467357b4aa6223e4dde5d6d7ed0
net/http: synchronize tests that use reqNum counters

This suppresses the race reported in #62638.

I am not 100% certain how that race happens, but here is my theory.
The increment of reqNum happens before the server writes the response
headers, and the server necessarily writes the headers before the
client receives them. However, that write/read pair occurs through I/O
syscalls rather than Go synchronization primitives, so it doesn't
necessarily create a “happens before” relationship as defined by the
Go memory model: although we can establish a sequence of events, that
sequence is not visible to the race detector, nor to the compiler.

Fixes #62638.

Change-Id: I90d66ec3fc32b9b8e1f9bbf0bc2eb289b964b99b
Reviewed-on: https://go-review.googlesource.com/c/go/+/528475
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Bryan Mills <bcmills@google.com>
src/net/http/serve_test.go