ractor icon indicating copy to clipboard operation
ractor copied to clipboard

Windows IPv4 connection regression

Open calebfletcher opened this issue 4 months ago • 1 comments

Describe the bug

#330 changed the listen address on ractor_cluster to listen to ::1 rather than 0.0.0.0 so that both IPv4 and IPv6 connections are available. However, this behavior is only the default on Linux, where dual-stack sockets are enabled by default, whereas on Windows the sockets are single-stack by default. This means that with the change, IPv4 connections no longer work on Windows.

The relevant socket flag is IPV6_V6ONLY. The Windows documentation is https://learn.microsoft.com/en-us/windows/win32/winsock/ipproto-ipv6-socket-options#options, which states "When this value is nonzero (the default on Windows), a socket created for the AF_INET6 address family can be used to send and receive IPv6 packets only.". The Linux documentation is in the ipv6 man pages https://linux.die.net/man/7/ipv6 which states the default is controlled by a /proc/sys file and "The default value for that file is 0 (false)".

There is a related discussion on Rust's issue tracker regarding the defaults and Tokio does not expose a way to control the IPV6_V6ONLY setting (see https://github.com/tokio-rs/tokio/pull/6171).

There are likely 3 main solutions to this:

  1. Revert #330 if IPv4 support is more important than IPv6
  2. Set IPV6_V6ONLY to the listen socket using a crate like socket2 with the set_only_v6 method. Would add another dependency, however tokio already pulls in socket2 so it is already an indirect dependency of ractor_cluster.
  3. Allow passing in the listen address to the NodeServer. This would allow either IPv4 or IPv6 clusters to work, however would not allow both to be used at the same time.

To Reproduce Steps to reproduce the behavior:

  1. Bring up a node on windows
  2. Attempt to connect to it using an IPv4 address
  3. Connection should fail

Expected behavior IPv4 connection should succeed as it did previously.

calebfletcher avatar Jul 27 '25 08:07 calebfletcher

Please feel free to put up a PR and I'm happy to review! I don't have a windows env to play around with at the moment, but I'm happy to take a look at and review any contributions. Thanks

slawlor avatar Aug 19 '25 21:08 slawlor