Skip to content

fix(telegram): force IPv4 DNS on Jetson to prevent happy eyeballs timeout#1151

Closed
BrianYang-123 wants to merge 1 commit intoNVIDIA:mainfrom
BrianYang-123:fix/telegram-ipv4-jetson
Closed

fix(telegram): force IPv4 DNS on Jetson to prevent happy eyeballs timeout#1151
BrianYang-123 wants to merge 1 commit intoNVIDIA:mainfrom
BrianYang-123:fix/telegram-ipv4-jetson

Conversation

@BrianYang-123
Copy link
Copy Markdown

@BrianYang-123 BrianYang-123 commented Mar 31, 2026

Summary

Force IPv4 DNS resolution in telegram-bridge.js on Jetson platforms to fix immediate crash on startup.

Problem

Node.js v22 enables the happy eyeballs algorithm (autoSelectFamily) by default. On Jetson Tegra kernels (5.15), IPv6 is non-functional — the kernel lacks proper IPv6 connectivity, returning ENETUNREACH for any IPv6 connection attempt.

The happy eyeballs implementation ignores dns.setDefaultResultOrder('ipv4first') and tries all address families regardless of DNS ordering (nodejs/node#52216). The failed IPv6 attempt (ENETUNREACH) causes the entire connection to fail with ETIMEDOUT, crashing the bridge on startup:

AggregateError [ETIMEDOUT]:
  Error: connect ETIMEDOUT 149.154.166.110:443
  Error: connect ENETUNREACH 2001:67c:4e8:f004::9:443

Changes

  • scripts/telegram-bridge.js: Override dns.lookup to force family: 4 (IPv4 only), guarded by /etc/nv_tegra_release detection so non-Jetson platforms are unaffected.

Why dns.lookup override instead of simpler alternatives

Approach Works? Why not
dns.setDefaultResultOrder('ipv4first') No autoSelectFamily ignores DNS result ordering
net.setDefaultAutoSelectFamily(false) No Does not affect undici/fetch()
--no-network-family-autoselection CLI flag No Same — does not affect undici
dns.lookup override with family: 4 Yes Prevents IPv6 addresses from reaching the connection layer entirely

Test plan

Tested on Jetson Orin NX (L4T R36.4.3, kernel 5.15.148-tegra, Node.js v22.13.1):

  • Without fix: bridge crashes immediately with ETIMEDOUT + ENETUNREACH
  • With setDefaultResultOrder('ipv4first') only: still crashes
  • With dns.lookup override (this PR): bridge starts and operates normally
  • Fix is guarded by /etc/nv_tegra_release — no behavior change on non-Jetson platforms

Summary by CodeRabbit

  • Bug Fixes
    • Ensures IPv4 DNS resolution on Jetson Tegra devices so outbound connections (e.g., the Telegram bridge) reliably use IPv4 when needed, improving connectivity and startup behavior.

Signed-off-by: brianyang brianyang@signalpro.com.tw

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 2096f094-b8ff-4e78-baee-61ae34a9e8aa

📥 Commits

Reviewing files that changed from the base of the PR and between ee81ca2 and b636176.

📒 Files selected for processing (1)
  • scripts/telegram-bridge.js
✅ Files skipped from review due to trivial changes (1)
  • scripts/telegram-bridge.js

📝 Walkthrough

Walkthrough

Conditionally applies a Jetson Tegra IPv4-only DNS override in scripts/telegram-bridge.js: imports dns and fs, saves original dns.lookup, and monkey-patches it to force IPv4 (family: 4) when /etc/nv_tegra_release exists, altering Node's hostname resolution only.

Changes

Cohort / File(s) Summary
DNS IPv4 Override
scripts/telegram-bridge.js
Added conditional startup-time DNS override for Jetson Tegra: imports dns and fs, stores original dns.lookup, and monkey-patches dns.lookup to force options.family = 4 (handling callback, number, or object forms) when /etc/nv_tegra_release is present; Telegram logic unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 In Tegra fields the packets play,
I nudge DNS to find the way,
IPv4 footsteps, tidy and small,
A rabbit's patch to guide them all. 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: forcing IPv4 DNS on Jetson platforms to prevent happy eyeballs timeout issues in the Telegram bridge.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@wscurran wscurran added bug Something isn't working Platform: AGX Thor/Orin Support for Jetson AGX Thor and Orin Integration: Telegram Use this label to identify Telegram bot integration issues with NemoClaw. labels Apr 1, 2026
…eout

Node.js v22 happy eyeballs (autoSelectFamily) tries IPv6 connections
even when dns.setDefaultResultOrder('ipv4first') is set. On Jetson
Tegra kernels (5.15), IPv6 is non-functional (ENETUNREACH), and the
failed IPv6 attempt causes the IPv4 connection to also ETIMEDOUT.

dns.setDefaultResultOrder('ipv4first') alone is insufficient because
autoSelectFamily ignores DNS result ordering and tries all address
families regardless. Forcing family:4 at the dns.lookup level is the
only reliable fix — it prevents IPv6 addresses from reaching the
connection layer entirely.

The fix is guarded by /etc/nv_tegra_release detection so non-Jetson
platforms are unaffected.

Tested on Jetson Orin NX (L4T R36.4.3, kernel 5.15.148-tegra):
- Without fix: bridge crashes immediately (ETIMEDOUT + ENETUNREACH)
- With fix: bridge connects and operates normally

Refs: nodejs/node#52216
Signed-off-by: brianyang <brianyang@signalpro.com.tw>
@BrianYang-123 BrianYang-123 force-pushed the fix/telegram-ipv4-jetson branch from c4c7c72 to b636176 Compare April 2, 2026 01:17
@BrianYang-123
Copy link
Copy Markdown
Author

Closing — the target file scripts/telegram-bridge.js was deleted in #1081 (merged 2026-04-05). Telegram messaging is now handled natively by OpenClaw via the OpenShell L7 proxy pipeline (Rust, not Node.js).

The IPv4 DNS fix (monkey-patching dns.lookup for Jetson) no longer applies since outbound requests now go through the Rust L7 proxy, which has its own DNS resolution path. If the IPv6 timeout issue resurfaces on Jetson with the new architecture, the fix would need to be at the system level (/etc/gai.conf) or in OpenShell's Rust networking code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Integration: Telegram Use this label to identify Telegram bot integration issues with NemoClaw. Platform: AGX Thor/Orin Support for Jetson AGX Thor and Orin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants