fix(scripts): force IPv4 DNS on WSL2 to prevent bridge ETIMEDOUT#1066
fix(scripts): force IPv4 DNS on WSL2 to prevent bridge ETIMEDOUT#1066phanisaimunipalli wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
On WSL2 + Docker Desktop, Node.js resolves dual-stack DNS records and tries IPv6 first. WSL2's IPv6 routing is broken, so the IPv6 attempt returns ENETUNREACH and the IPv4 attempt times out with ETIMEDOUT. This causes the Telegram bridge (and any future host-side bridge) to fail immediately after start — the process exits and the PID file becomes stale. Detect WSL2 via the standard environment variables (WSL_DISTRO_NAME, WSL_INTEROP) and the /proc/version marker, then export NODE_OPTIONS=--dns-result-order=ipv4first before launching bridge processes. This makes Node.js use IPv4 results exclusively for DNS lookups, which resolves the ETIMEDOUT without affecting non-WSL2 deployments. Fixes NVIDIA#1065. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughA WSL2 detection mechanism was added to Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
✨ Thanks for submitting this PR with a detailed summary, it addresses a bug with IPv6 routing on WSL2 and proposes a fix to improve the compatibility of NemoClaw with this platform. |
Problem
On Windows WSL2 + Docker Desktop,
nemoclaw startlaunches the Telegram bridge but the bridge process exits within seconds.nemoclaw statusthen shows it as stopped even though it was just started.Root cause: WSL2 ships with broken IPv6 routing. Node.js resolves dual-stack DNS records and tries IPv6 addresses first. The IPv6 attempt returns
ENETUNREACHand the IPv4 attempt times out withETIMEDOUT:This affects
api.telegram.organd would affectgateway.discord.ggfor any host-side bridge.curlis unaffected because it uses a CONNECT tunnel, not the Node.jshttp.Agentpath.Fix
Detect WSL2 via the standard environment variables (
WSL_DISTRO_NAME,WSL_INTEROP) and the/proc/versionmarker. When WSL2 is detected, exportNODE_OPTIONS=--dns-result-order=ipv4firstbefore launching bridge processes so Node.js uses IPv4 DNS results exclusively.This is a safe, additive change — it does not affect Linux, macOS, or cloud VM deployments. The
--dns-result-order=ipv4firstflag has been available since Node.js 17.Testing
ifblock does not executeNODE_OPTIONSis set beforenohup node telegram-bridge.js— bridge connects toapi.telegram.orgvia IPv4 immediatelyFixes #1065.
🤖 Generated with Claude Code
Summary by CodeRabbit