Repository navigation
Description
Summary
On WSL2, starting cmd hangs for ~60 seconds before entering the interactive UI, and does not respond to Ctrl+C (SIGINT) during the hang. strace shows that the main process performs 6 consecutive, blocking reverse DNS (PTR) lookups for the host's local LAN IP (192.168.1.x), each timing out after ~10 seconds.
Expected Behavior
cmd should start within 1–2 seconds without blocking the startup critical path on reverse DNS (PTR) lookups for private/local IPs. Pressing Ctrl+C (SIGINT) during startup should cleanly interrupt the process.
Actual Behavior
cmd hangs for ~60 seconds before rendering the interactive UI and ignores Ctrl+C while blocked.
Tracing with strace reveals that the main process enumerates local network interfaces (RTM_GETADDR) and then synchronously queries x.1.168.192.in-addr.arpa (PTR) 6 times in a row. Because WSL2 DNS tunneling (10.255.255.254) silently drops PTR queries for the host's own LAN IP, each query hits glibc's default timeout (5s × 2 attempts = ~10.01s), resulting in a ~60s freeze.
Steps to reproduce the issue
- Use WSL2 (Ubuntu 26.04.1 LTS) on Windows with DNS tunneling enabled (
10.255.255.254) in an environment where PTR lookups for the host's local LAN IP (192.168.1.x) time out (and the IP is not mapped in/etc/hosts). - Run
cmdin the terminal. - Observe that
cmdhangs for ~60 seconds before entering the interactive UI, andCtrl+Chas no effect during the hang.
Command Code Version
1.93.2
Operating System
WSL2 (Ubuntu 26.04.1 LTS) on Windows
Terminal/IDE
Windows Terminal
Shell
bash
Session file (optional)
No response
Fix prompt (optional)
Investigate startup initialization and any networking/telemetry/diagnostics code that enumerates local interfaces or triggers reverse DNS (PTR) lookups (dns.reverse, dns.lookupService, or native getnameinfo()). Do not perform synchronous/blocking PTR lookups on the startup critical path: skip PTR lookups for RFC 1918 private IPs (or pass NI_NUMERICHOST if calling getnameinfo()), make any necessary lookup asynchronous with a short timeout (e.g., 1–2s) and negative caching so a failing IP is not retried 6 times serially. Also ensure SIGINT (Ctrl+C) can interrupt startup cleanly.
Additional context
- Node.js version:
v22.23.5 - Network setup: WSL2 with DNS tunneling (
10.255.255.254)
strace evidence
Captured via strace -f -tt -s 200 -o /tmp/cmd_dns.log -e trace=connect,sendto cmd (local LAN IP redacted to 192.168.1.x):
100862 13:22:08.840165 sendto(33, [{nlmsg_len=20, nlmsg_type=RTM_GETADDR, ...}], ...) = 20
100862 13:22:08.848333 connect(33, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.255.255.254")}, 16) = 0
100862 13:22:08.848677 sendto(33, "\7\226\1\0\0\1\0\0\0\0\0\0\1x\0011\003168\003192\7in-addr\4arpa\0\0\f\0\1", 43, MSG_NOSIGNAL, NULL, 0) = 43
100862 13:22:13.853566 sendto(33, "\7\226\1\0\0\1\0\0\0\0\0\0\1x\0011\003168\003192\7in-addr\4arpa\0\0\f\0\1", 43, MSG_NOSIGNAL, NULL, 0) = 43
100862 13:22:18.860222 connect(33, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("10.255.255.254")}, 16) = 0
... (repeats 6 times at ~10.01s intervals until 13:23:08)
Note: PTR lookups for public IPs (e.g., 104.26.8.108, 172.67.69.147) resolve in ~10ms, whereas the local LAN IP PTR times out every time.
Workaround
Adding the local LAN IP to /etc/hosts completely eliminates the 60s hang and cmd starts in 1–2 seconds:
echo "192.168.1.x \$(hostname)" | sudo tee -a /etc/hosts
Activity