internal/http3: avoid data race for roundTripState.reqBody There is currently a data race because roundTripState.reqBody is written in writeBodyAndTrailer, which might execute concurrently with closeReqBody that reads roundTripState.reqBody. To avoid the data race, initialize roundTripState.reqBody early. This ensures that the roundTripState is no longer going to be written to by the time that it is given as part of a transportResponseBody, whose Close method uses closeReqBody. The test for this behavior is in std. This data race was found as part of running net/http test against x/net/internal/http3. For golang/go#70914 Change-Id: I9c97007bea4883e93c2075d1f1b48c356a6a6964 Reviewed-on: https://go-review.googlesource.com/c/net/+/765520 Reviewed-by: Nicholas Husin <husin@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Auto-Submit: Nicholas Husin <husin@google.com>
This repository holds supplementary Go networking packages.
This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://go.dev/doc/contribute.
The git repository is https://go.googlesource.com/net.
The main issue tracker for the net repository is located at https://go.dev/issues. Prefix your issue with “x/net:” in the subject line, so it is easy to find.