Re:Golang is evil on shitty networks
by SomaticPirate on Thursday December 29, 2022 @07:20PM
(#34179982)
Go’s choice to default to its own TCP/IP implementation has bitten me personally to the level of requiring a machine restart.
The Go IPv6 DNS resolution on MacOS can cause all DNS requests on the system to begin to fail until a restart.
Re:Golang is evil on shitty networks
by alecthomas on Thursday December 29, 2022 @10:17PM
(#34181391)
Not to understate the impact of the bug, but this is not the default for Go. It is used if CGo is disabled, as the issue you linked to describes.
That is the default for Go if cross-compiled, however, and most software compiled on a CI server is cross-compiled to Darwin.
Fortunately Go 1.20 fixes this, using the system resolved even without CGo on Darwin platforms [1].
The OS network stack is crashing and this is Go's fault? Is Go holding the network stack wrong?
Re:Golang is evil on shitty networks
by LaLaLand122 on Friday December 30, 2022 @12:53AM
(#34182259)
To be fair, "getaddrinfo is _the_ path" is a shitty situation.
- It's a synchronous interface. Things like getaddrinfo_a are barely better. It has forced people to do stuff like https://c-ares.org/ for ages, which has suffered from "is not _the_ path" issues for as long
- It's a less featured interface than, for example, https://wiki.freedesktop.org/www/Software/systemd/writing-re...
I don’t know why it is, exactly… but I think it’s related to Golang intentionally avoiding using the system libc and implementing its own low-level TCP/IP functions, leading to it not using the system configuration which tells it which interface to use for which connections.
Edit: now that I think about it, I think the issue is with DNS… macOS can be configured such that some subdomains (like on a VPN) are resolved with different DNS servers than others, which helps isolate things so that you only use your VPN’s DNS server for connections that actually need it. Go’s DNS resolution ignores this configuration system and just uses the same server for all DNS resolution, hence the issue.