-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: go1.24.1 macOS without netgo (native) uses IPv6 instead of Dialcontext provided ipv4 #72748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Code used to select explicit IP is I'm struggling to reduce further the repro |
Same issue with as early as go1.24rc1 as well as gotip bc5f4a5
|
You have a race with connection pooling. https://pkg.go.dev/net/http#Transport
Unlike many projects, the Go project does not use GitHub Issues for general discussion or asking questions. GitHub Issues are used for tracking bugs and proposals only. For questions please refer to https://github.com/golang/go/wiki/Questions |
@seankhliao Please kindly take a look at this issue once again. The problem is that net library somehow connects to IPv6 endpoint even in case when numeric IPv4 address specified to actual dialer. The remaining details of this issue suggest that it has something to do with native Mac OS resolving and such "connection coalescing" happens only if resolver was "asked" about domain having such IP addresses in question. |
spent some time bisect'ing 0bb2183 works
6a4feb5 fails though that commit, while related to darwin doesn't quite explain how it would cause this (@cherrymui any ideas?)
|
No connection to ipv6 is made yet it uses ipv6 even on the first ipv4 connection - also the code is single goroutine Even making a single connection does unexpected ipv6:
key parts: 13:17:53.147 [VRB] 1: DialContext tcp debug.fortio.org:80 -> 192.9.142.5:80 (wireshark also shows that switch and GODEBUG=multipathtcp=0 also doesn't help) |
GODEBUG=netdns=go |
confirmed in slack that the program was using ipv4. the rewrite to ipv6 happens outside of go. |
yes indeed yet it only happens with that linker change - somehow - curious how that transparent proxy like thing shows up up with that linker change |
Go version
go version go1.24.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
I have a debug service that is hosted on 3 different VMs
And a tool that exercise each address - with go1.24.1 on macos 15.3.1 (24D70) with 10/10 https://test-ipv6.com
Despite using ipv4 from go, it connects using the same shared IPv6 address (thus connects to same server) and only for http (not https)
go1.24.1 run fortio.org/multicurl@v1.16.1 -4 -loglevel debug http://debug.fortio.org # bad
vs
go1.23.7 run fortio.org/multicurl@v1.16.1 -4 -loglevel debug http://debug.fortio.org # good
What did you see happen?
Ie it connects to the wrong server using ipv6 instead of the specified ipv4
To reduce the output:
3 times the same server
What did you expect to see?
Same as go1.23 (or -tags netgo)
3 different servers
The text was updated successfully, but these errors were encountered: