From: qmuntal Date: Tue, 13 May 2025 12:28:01 +0000 (+0200) Subject: net: avoid windows hang in TestCloseWrite X-Git-Tag: go1.25rc1~263 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8105ea53c3d17546a35709d51e6e0993b1d0c261;p=gostls13.git net: avoid windows hang in TestCloseWrite On Windows, reading from a socket at the same time as the other end is closing it will occasionally hang. This is a Windows issue, not a Go issue, similar to what happens in macOS (see #49352). Work around this condition by adding a brief sleep before the read. Fixes #73140. Change-Id: I24e457a577e507d0d69924af6ffa1aa24c4aaaa6 Reviewed-on: https://go-review.googlesource.com/c/go/+/671457 Reviewed-by: Michael Knyszek LUCI-TryBot-Result: Go LUCI Auto-Submit: Alan Donovan Reviewed-by: Alan Donovan Commit-Queue: Alan Donovan Reviewed-by: Damien Neil --- diff --git a/src/net/net_test.go b/src/net/net_test.go index bca6c99074..7269db8f2b 100644 --- a/src/net/net_test.go +++ b/src/net/net_test.go @@ -98,12 +98,12 @@ func TestCloseWrite(t *testing.T) { } // Workaround for https://go.dev/issue/49352. - // On arm64 macOS (current as of macOS 12.4), + // On Windows and arm64 macOS (current as of macOS 12.4), // reading from a socket at the same time as the client // is closing it occasionally hangs for 60 seconds before // returning ECONNRESET. Sleep for a bit to give the // socket time to close before trying to read from it. - if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" { + if runtime.GOOS == "windows" || (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") { time.Sleep(10 * time.Millisecond) }