The Windows implementation of several network protocols make use of
sync.Pool, which randomly drops cached items when race is enabled.
While here, zero out the control buffer to allow it to be garbage
collected.
Fixes #75341
Change-Id: Ie20e21adef2edc02ca7b4a78012dd5f3a9f03bee
Reviewed-on: https://go-review.googlesource.com/c/go/+/703195
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
// Clear pointers to buffers so they can be released by garbage collector.
msg.Buffers.Len = 0
msg.Buffers.Buf = nil
+ msg.Control.Len = 0
+ msg.Control.Buf = nil
wsaMsgPool.Put(msg)
}
"errors"
"fmt"
"internal/asan"
+ "internal/race"
"internal/testenv"
"net/netip"
"os"
case "plan9", "js", "wasip1":
// These implementations have not been optimized.
t.Skipf("skipping on %v", runtime.GOOS)
+ case "windows":
+ if race.Enabled {
+ // The Windows implementation make use of sync.Pool,
+ // which randomly drops cached items when race is enabled.
+ t.Skip("skipping test in race")
+ }
}
if !testableNetwork("udp4") {
t.Skipf("skipping: udp4 not available")