From 4795c731a4607af6e31a95c3592619368b595c91 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Ritschard Date: Thu, 27 Feb 2025 13:42:57 +0100 Subject: [PATCH] socket: set ipv6 preference to false Torch relies on explicitly setting the address family to AF_INET6 by default when using `getaddrinfo`. This results in ENONAME on systems which do not have IPv6 available, as is the case within EKS in our setup. The correct behavior should be to set the family to AF_UNSPEC, and if necessary to rely on `gai.conf` to set precedence to control which address is returned first. This will be addressed separately by raising a PR upstream. In the interval, our fork should default to IPv4 to allow host lookups to work as intended. --- torch/csrc/distributed/c10d/socket.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/torch/csrc/distributed/c10d/socket.h b/torch/csrc/distributed/c10d/socket.h index 81659f11f049f..45543b298ae17 100644 --- a/torch/csrc/distributed/c10d/socket.h +++ b/torch/csrc/distributed/c10d/socket.h @@ -52,7 +52,8 @@ class SocketOptions { } private: - bool prefer_ipv6_ = true; + // XXX: keeping this here for now, addressing separately upstream + bool prefer_ipv6_ = false; std::chrono::milliseconds connect_timeout_{std::chrono::seconds{30}}; std::shared_ptr connect_backoff_{ std::make_shared(std::chrono::milliseconds(1000))};