dart:io does not use ipv6 on ubuntu 24.04 unless forced #60192
Labels
area-vm
Use area-vm for VM related issues, including code coverage, and the AOT and JIT backends.
library-io
P2
A bug or feature request we're likely to work on
triaged
Issue has been triaged by sub team
When making http requests to generativelanguage.googleapis.com Dart always goes through ipv4. For some reason, Hetzner's ipv4 addresses for their VPS are blocked. Going through ipv6 works. Other tools (curl, httpie, python) default to ipv6 (but fail when forced to use ipv4 eg. curl -4). Configuring the OS to always prefer ipv6 over ipv4 does not change the dart:io behaviour. The workaround is manually making a request to google's ipv6 address and handling the certificate failure, since this results in a mismatch. Or using a proxy in a custom http client to circumvent the ipv4 block. (this is speculative, but have found others reporting the same block for their ipv4 from Hetzner)
Surely there must be a cleaner way to tell IOClient or HttpClient to use ipv6 instead of ipv4.
This is using
on Ubuntu 24.04.1 LTS.
Edit: Is this the culprit, on line 702? Staggered lookup, which checks ipv4 first.
https://github.com/dart-lang/sdk/blob/main/sdk/lib/_internal/vm/bin/socket_patch.dart
Issue referenced: #50868
Edit 2: Since this looks like a dart wide issue, maybe this should be renamed to account for new information. Dart outright refusing to use ipv6 over ipv4 is in contradiction with other tools and works against expectations. This results in very hard to debug and hard to work with scenarios. That is, if I'm understanding this correctly.
The text was updated successfully, but these errors were encountered: