Repository: go
Issue: net/http:  TestCancelRequestWithChannelBeforeDo_Cancel/h2 failure with `leaked a timing out dial` on Windows
Labels: OS-Windows,NeedsInvestigation

```
#!watchflakes
post <- pkg == "net/http" && test ~ `TestCancelRequestWithChannelBeforeDo_Cancel` && `Test appears to have leaked a timing out dial:`
```

### What version of Go are you using (`go version`)?

<pre>
C:\Users\bryan\src\go\src>go version
go version devel go1.21-66cac9e1e4 Fri Apr 7 23:34:21 2023 +0000 windows/amd64

</pre>


### What operating system and processor architecture are you using (`go env`)?

<details><summary><code>go env</code> Output</summary><br><pre>
C:\Users\bryan\src\go\src>go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\bryan\AppData\Local\go-build
set GOENV=C:\Users\bryan\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\bryan\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\bryan\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Users\bryan\src\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Users\bryan\src\go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=devel go1.21-66cac9e1e4 Fri Apr 7 23:34:21 2023 +0000
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=C:\Users\bryan\src\go\src\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\bryan\AppData\Local\Temp\go-build4136781064=/tmp/go-build -gno-record-gcc-switches

</pre></details>

### What did you do?

`go test std cmd -timeout=1h`


### What did you expect to see?

All tests passing.


### What did you see instead?

<details>

```
--- FAIL: TestCancelRequestWithChannelBeforeDo_Cancel (5.00s)
    --- FAIL: TestCancelRequestWithChannelBeforeDo_Cancel/h2 (2.61s)
        main_test.go:141: Test appears to have leaked a timing out dial:
            internal/poll.runtime_pollWait(0x157bb677028, 0x77)
                C:/Users/bryan/src/go/src/runtime/netpoll.go:306 +0x85
            internal/poll.(*pollDesc).wait(0xc000402030?, 0x30?, 0x0)
                C:/Users/bryan/src/go/src/internal/poll/fd_poll_runtime.go:84 +0x27
            internal/poll.execIO(0xc000236868, 0xaa0ac0)
                C:/Users/bryan/src/go/src/internal/poll/fd_windows.go:175 +0xe6
            internal/poll.(*FD).ConnectEx(0xfaf7?, {0xb20500?, 0xc000136460?})
                C:/Users/bryan/src/go/src/internal/poll/fd_windows.go:926 +0x54
            net.(*netFD).connect(0xc000236780, {0xb238e8?, 0xe2de78}, {0x0, 0x0?}, {0xb20500?, 0xc000136460})
                C:/Users/bryan/src/go/src/net/fd_windows.go:106 +0x393
            net.(*netFD).dial(0xc000236780, {0xb238e8, 0xe2de78}, {0xb24400?, 0x0?}, {0xb24400?, 0xc000508c00}, 0xc0001c92a8?)
                C:/Users/bryan/src/go/src/net/sock_posix.go:151 +0x3ca
            net.socket({0xb238e8, 0xe2de78}, {0xa50823, 0x3}, 0x2, 0x1, 0x0?, 0x0?, {0xb24400, 0x0}, ...)
                C:/Users/bryan/src/go/src/net/sock_posix.go:70 +0x2af
            net.internetSocket({0xb238e8, 0xe2de78}, {0xa50823, 0x3}, {0xb24400, 0x0}, {0xb24400?, 0xc000508c00?}, 0x1?, 0x0, ...)
                C:/Users/bryan/src/go/src/net/ipsock_posix.go:142 +0x1e5
            net.(*sysDialer).doDialTCPProto(0xc000074000, {0xb238e8, 0xe2de78}, 0x0, 0xc000508bd0?, 0xc0007d8680?)
                C:/Users/bryan/src/go/src/net/tcpsock_posix.go:78 +0xe9
            net.(*sysDialer).doDialTCP(...)
                C:/Users/bryan/src/go/src/net/tcpsock_posix.go:68
            net.(*sysDialer).dialTCP(0x28?, {0xb238e8?, 0xe2de78?}, 0xc0003bb668?, 0x781625?)
                C:/Users/bryan/src/go/src/net/tcpsock_posix.go:64 +0x65
            net.(*sysDialer).dialSingle(0xc000074000, {0xb238e8, 0xe2de78}, {0xb21cc8?, 0xc000508c00})
                C:/Users/bryan/src/go/src/net/dial.go:639 +0x24b
            net.(*sysDialer).dialSerial(0xc000074000, {0xb238e8, 0xe2de78}, {0xc000230c10?, 0x1, 0x77f232?})
                C:/Users/bryan/src/go/src/net/dial.go:604 +0x248
            net.(*sysDialer).dialParallel(0xc000230be0?, {0xb238e8?, 0xe2de78?}, {0xc000230c10?, 0xe2de78?, 0xa50b21?}, {0x0?, 0xa50823?, 0x5a4fe8?})
                C:/Users/bryan/src/go/src/net/dial.go:505 +0x3e5
            net.(*Dialer).DialContext(0xdd78e0, {0xb238e8, 0xe2de78}, {0xa50823, 0x3}, {0xc0001865a0, 0xf})
                C:/Users/bryan/src/go/src/net/dial.go:496 +0x6de
            net/http.(*Transport).dial(0x5b1745?, {0xb238e8?, 0xe2de78?}, {0xa50823?, 0x59f1e5?}, {0xc0001865a0?, 0xa37b20?})
                C:/Users/bryan/src/go/src/net/http/transport.go:1192 +0xb4
            net/http.(*Transport).dialConn(0xc0000763c0, {0xb238e8, 0xe2de78}, {{}, 0x0, {0xc00001c510, 0x5}, {0xc0001865a0, 0xf}, 0x0})
                C:/Users/bryan/src/go/src/net/http/transport.go:1621 +0x7e8
            net/http.(*Transport).dialConnFor(0xc00072c340?, 0xc0000a6370)
                C:/Users/bryan/src/go/src/net/http/transport.go:1463 +0xa5
            created by net/http.(*Transport).queueForDial in goroutine 25162
                C:/Users/bryan/src/go/src/net/http/transport.go:1432 +0x3d5

            net.(*netFD).connect.func2()
                C:/Users/bryan/src/go/src/net/fd_windows.go:95 +0x6b
            created by net.(*netFD).connect in goroutine 25164
                C:/Users/bryan/src/go/src/net/fd_windows.go:94 +0x376

            testing.(*T).Parallel(0xc00027f6c0)
                C:/Users/bryan/src/go/src/testing/testing.go:1403 +0x205
            net/http.TestCmdGoNoHTTPServer(0xc00027f6c0)
                C:/Users/bryan/src/go/src/net/http/http_test.go:85 +0x2a
            testing.tRunner(0xc00027f6c0, 0xaa0d20)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad

            testing.(*T).Parallel(0xc00027f860)
                C:/Users/bryan/src/go/src/testing/testing.go:1403 +0x205
            net/http.TestOmitHTTP2(0xc00027f860)
                C:/Users/bryan/src/go/src/net/http/http_test.go:119 +0x87
            testing.tRunner(0xc00027f860, 0xaa0da0)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad

            testing.(*T).Parallel(0xc00027fa00)
                C:/Users/bryan/src/go/src/testing/testing.go:1403 +0x205
            net/http.TestOmitHTTP2Vet(0xc00027fa00)
                C:/Users/bryan/src/go/src/net/http/http_test.go:131 +0x25
            testing.tRunner(0xc00027fa00, 0xaa0d98)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad

            testing.(*T).Parallel(0xc0002a6ea0)
                C:/Users/bryan/src/go/src/testing/testing.go:1403 +0x205
            net/http.TestRequestWriteTransport(0xc0002a6ea0)
                C:/Users/bryan/src/go/src/net/http/requestwrite_test.go:668 +0x2a
            testing.tRunner(0xc0002a6ea0, 0xaa0e40)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad

            testing.(*T).Parallel(0xc0002a7860)
                C:/Users/bryan/src/go/src/testing/testing.go:1403 +0x205
            net/http.TestReadResponseCloseInMiddle(0xc0002a7860)
                C:/Users/bryan/src/go/src/net/http/response_test.go:647 +0x2a
            testing.tRunner(0xc0002a7860, 0xaa0de8)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad

            testing.(*T).Parallel(0xc0002da1a0)
                C:/Users/bryan/src/go/src/testing/testing.go:1403 +0x205
            net/http_test.TestConsumingBodyOnNextConn(0xc0002da1a0)
                C:/Users/bryan/src/go/src/net/http/serve_test.go:167 +0x3e
            testing.tRunner(0xc0002da1a0, 0xaa1380)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad

            testing.(*T).Run(0xc000051380, {0xa72efb?, 0x60102d?}, 0xaa11d0)
                C:/Users/bryan/src/go/src/testing/testing.go:1649 +0x3c8
            testing.runTests.func1(0xdd8300?)
                C:/Users/bryan/src/go/src/testing/testing.go:2055 +0x3e
            testing.tRunner(0xc000051380, 0xc000095c30)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            testing.runTests(0xc000074d20?, {0xdd1c20, 0x1fc, 0x1fc}, {0x59cac9?, 0xc000095d40?, 0xdd7860?})
                C:/Users/bryan/src/go/src/testing/testing.go:2053 +0x445
            testing.(*M).Run(0xc000074d20)
                C:/Users/bryan/src/go/src/testing/testing.go:1925 +0x636
            net/http_test.TestMain(0xc000057f30?)
                C:/Users/bryan/src/go/src/net/http/main_test.go:24 +0x27
            main.main()
                _testmain.go:1127 +0x1c6

            testing.(*T).Run(0xc00072c4e0, {0xa50564?, 0x2c?}, 0xc000508060)
                C:/Users/bryan/src/go/src/testing/testing.go:1649 +0x3c8
            net/http_test.run[...](0xc00072c4e0, 0xaa11c8, {0x0, 0x0, 0x1000})
                C:/Users/bryan/src/go/src/net/http/clientserver_test.go:82 +0x26f
            net/http_test.TestCancelRequestWithChannelBeforeDo_Cancel(0xc00072c1a0?)
                C:/Users/bryan/src/go/src/net/http/transport_test.go:2608 +0x2b
            testing.tRunner(0xc00072c4e0, 0xaa11d0)
                C:/Users/bryan/src/go/src/testing/testing.go:1595 +0xff
            created by testing.(*T).Run in goroutine 1
                C:/Users/bryan/src/go/src/testing/testing.go:1648 +0x3ad
FAIL
FAIL    net/http        83.327s
```

</details>

(attn @neild @golang/windows)