Skip to content

Commit 8105ea5

Browse files
qmuntalgopherbot
authored andcommitted
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 <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Auto-Submit: Alan Donovan <[email protected]> Reviewed-by: Alan Donovan <[email protected]> Commit-Queue: Alan Donovan <[email protected]> Reviewed-by: Damien Neil <[email protected]>
1 parent bb0c14b commit 8105ea5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/net/net_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ func TestCloseWrite(t *testing.T) {
9898
}
9999

100100
// Workaround for https://go.dev/issue/49352.
101-
// On arm64 macOS (current as of macOS 12.4),
101+
// On Windows and arm64 macOS (current as of macOS 12.4),
102102
// reading from a socket at the same time as the client
103103
// is closing it occasionally hangs for 60 seconds before
104104
// returning ECONNRESET. Sleep for a bit to give the
105105
// socket time to close before trying to read from it.
106-
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
106+
if runtime.GOOS == "windows" || (runtime.GOOS == "darwin" && runtime.GOARCH == "arm64") {
107107
time.Sleep(10 * time.Millisecond)
108108
}
109109

0 commit comments

Comments
 (0)