Which Cloudflare product(s) does this pertain to?
Wrangler
What version(s) of the tool(s) are you using?
wrangler: 4.73.0 (also reproduced on 4.72.0)
workerd: 1.20260312.1 (also reproduced on 1.20260310.1)
What version of Node are you using?
22.22.0
What operating system and version are you using?
NixOS Linux (kernel 6.13.6)
Describe the Bug
Observed behavior
When IPv6 is disabled on the host network, wrangler dev starts and prints "Ready on http://localhost:8787" but never responds to any HTTP requests. The main workerd process immediately consumes 100% CPU and spins indefinitely. All endpoints (including static doc routes that don't touch any bindings) time out.
Debug logs (--log-level debug) show a tight infinite loop of:
exception = kj/async-io-unix.c++:1538: disconnected: connect(): Connection refused
uncaught exception; source = Uncaught (in promise); stack = Error: Network connection lost.
This repeats hundreds of times per second with no backoff, starving the workerd event loop so it cannot process any HTTP requests.
Root cause
The wrangler dev architecture uses two processes:
- A Node.js process (wrangler CLI) that listens on an internal loopback port
- A workerd process configured with
--external-addr=loopback=localhost:<PORT>
The bug is an IPv4/IPv6 address mismatch between the two:
- Node.js binds its internal loopback port to
[::1] (IPv6 only) β confirmed via ss -tlnp
- workerd resolves
localhost to 127.0.0.1 (IPv4) first
- The IPv4 connection is refused (nothing listening on
127.0.0.1:<PORT>)
- workerd retries immediately in a tight loop with no backoff β 100% CPU
Evidence:
# Node binds IPv6 only:
$ ss -tlnp | grep <PORT>
LISTEN 0 511 [::1]:<PORT> [::]:* users:(("node",pid=...,fd=...))
# IPv4 fails, IPv6 succeeds:
$ curl http://127.0.0.1:<PORT>/ β exit 7 (connection refused)
$ curl http://[::1]:<PORT>/ β exit 0 (success)
# workerd uses localhost which resolves to IPv4 first:
$ cat /proc/<workerd_pid>/cmdline | tr '\0' ' ' | grep -oP 'loopback=[^ ]+'
loopback=localhost:<PORT>
Expected behavior
wrangler dev should work correctly when IPv6 is disabled on the host. Specifically:
- Node.js and workerd should agree on the loopback address (both use
127.0.0.1, or use 0.0.0.0/dual-stack)
- If the loopback connection fails, workerd should implement exponential backoff instead of a tight retry loop
- Alternatively, wrangler should pass an explicit IP address (
127.0.0.1) instead of localhost for --external-addr=loopback=
Workaround
Forcing Node.js to prefer IPv4 resolves the issue:
NODE_OPTIONS="--dns-result-order=ipv4first" wrangler dev
This makes Node.js bind to 127.0.0.1 instead of [::1], matching what workerd expects.
Steps to reproduce
- Disable IPv6 on your network interface (e.g., via NetworkManager, sysctl
net.ipv6.conf.all.disable_ipv6=1, or router settings)
- Ensure
/etc/hosts still has both 127.0.0.1 localhost and ::1 localhost (default on most distros)
- Create any Cloudflare Worker project with
nodejs_compat enabled
- Run
wrangler dev
- Try
curl http://localhost:8787/ β it will hang indefinitely
- Check CPU:
ps aux | grep workerd shows ~100% CPU usage
Related issues
Please provide any relevant error logs
Debug output (wrangler dev --log-level debug) shows the repeating pattern immediately at startup, before any HTTP request:
exception = kj/async-io-unix.c++:1538: disconnected: connect(): Connection refused
stack: ...workerd@4f45f62 ...workerd@4f461eb ...
uncaught exception; source = Uncaught (in promise); stack = Error: Network connection lost.
uncaught exception; exception = workerd/jsg/_virtual_includes/iterator/workerd/jsg/value.h:1480: disconnected: jsg.Error: Network connection lost.
stack: ...workerd@2cfbe50 ...workerd@2cfca8e ...
This pattern repeats hundreds of times per second with no backoff.
Environment details
wrangler: 4.73.0
workerd: 1.20260312.1
node: 22.22.0
bun: 1.3.9
OS: NixOS Linux, kernel 6.13.6
IPv6: disabled on network interfaces
/etc/hosts: both 127.0.0.1 and ::1 mapped to localhost
Which Cloudflare product(s) does this pertain to?
Wrangler
What version(s) of the tool(s) are you using?
wrangler: 4.73.0 (also reproduced on 4.72.0)
workerd: 1.20260312.1 (also reproduced on 1.20260310.1)
What version of Node are you using?
22.22.0
What operating system and version are you using?
NixOS Linux (kernel 6.13.6)
Describe the Bug
Observed behavior
When IPv6 is disabled on the host network,
wrangler devstarts and prints "Ready on http://localhost:8787" but never responds to any HTTP requests. The mainworkerdprocess immediately consumes 100% CPU and spins indefinitely. All endpoints (including static doc routes that don't touch any bindings) time out.Debug logs (
--log-level debug) show a tight infinite loop of:This repeats hundreds of times per second with no backoff, starving the workerd event loop so it cannot process any HTTP requests.
Root cause
The wrangler dev architecture uses two processes:
--external-addr=loopback=localhost:<PORT>The bug is an IPv4/IPv6 address mismatch between the two:
[::1](IPv6 only) β confirmed viass -tlnplocalhostto127.0.0.1(IPv4) first127.0.0.1:<PORT>)Evidence:
Expected behavior
wrangler devshould work correctly when IPv6 is disabled on the host. Specifically:127.0.0.1, or use0.0.0.0/dual-stack)127.0.0.1) instead oflocalhostfor--external-addr=loopback=Workaround
Forcing Node.js to prefer IPv4 resolves the issue:
NODE_OPTIONS="--dns-result-order=ipv4first" wrangler devThis makes Node.js bind to
127.0.0.1instead of[::1], matching what workerd expects.Steps to reproduce
net.ipv6.conf.all.disable_ipv6=1, or router settings)/etc/hostsstill has both127.0.0.1 localhostand::1 localhost(default on most distros)nodejs_compatenabledwrangler devcurl http://localhost:8787/β it will hang indefinitelyps aux | grep workerdshows ~100% CPU usageRelated issues
nodejs_compat)x-dev-env- worker hangs after first request in GH ActionsΒ #7635 β Worker hangs after first request (ProxyWorker pause/play race)Please provide any relevant error logs
Debug output (
wrangler dev --log-level debug) shows the repeating pattern immediately at startup, before any HTTP request:This pattern repeats hundreds of times per second with no backoff.
Environment details