Per the Workers Platform Limits docs:
Each Worker invocation can have up to six connections simultaneously waiting for response headers. ... If a seventh connection is attempted while six are already waiting for headers, it is queued until one of the existing connections receives its response headers.
In production this cap is enforced (six in‑flight subrequests). In wrangler dev / workerd locally, it is not: the Worker can have arbitrarily many in‑flight fetches.
Code that relies on the production clamp (or simply uses Promise.all(array.map(fetch)) for convenience) works fine in prod and misbehaves locally. Depending on the fetch target this can manifest as:
- The dev server freezing to unrelated requests (event‑loop / IO starvation).
- Host‑level ephemeral port exhaustion.
- Out‑of‑memory errors as response bodies buffer.
The inverse mismatch is also possible: code tuned to run fast locally exceeds the 6‑cap in prod and hits the "cancel LRU subrequest to make room" behaviour documented in workerd#4471.
npm install
# Terminal A: local echo server that reports max concurrent in-flight requests
node echo-server.mjs 9192 1000
# Terminal B:
npx wrangler dev # listens on localhost:9191
# Terminal C:
curl "http://localhost:9191/storm?n=100"
curl "http://localhost:9191/storm?n=500"
curl "http://localhost:9191/storm?n=2000"Output observed on wrangler 4.84.0 / macOS:
{ "n": 100, "ok": 100, "maxInFlightObservedByTarget": 100, "elapsedMs": 1022 }
{ "n": 500, "ok": 500, "maxInFlightObservedByTarget": 500, "elapsedMs": 1108 }
{ "n": 2000, "ok": 2000, "maxInFlightObservedByTarget": 2000, "elapsedMs": 1454 }The maxInFlightObservedByTarget field is the max concurrent in‑flight HTTP requests the target server saw. Deployed to Workers production, this value is 6.
Start the echo server with a 30s delay and fire a storm against an external HTTPS target:
node echo-server.mjs 9192 30000 &
# and/or change the target url in /storm to https://example.com
curl "http://localhost:9191/storm?n=5000&target=https://example.com" &
# while storm is in-flight, from another terminal:
curl --max-time 5 "http://localhost:9191/probe"Probes against /probe (a trivial endpoint) time out for tens of seconds because workerd is saturated handling thousands of TCP/TLS connections. On macOS the host itself can also run out of ephemeral ports, breaking all outbound connections system‑wide until workerd is killed.
wrangler dev / workerd should clamp concurrent outgoing subrequests to the same six that prod enforces, so that:
- Code behaviour locally matches production.
- Accidental fan‑outs don't DoS the dev machine.
Ideally exposed as a limits.simultaneousConnections field analogous to the limits.subrequests that #11803 added, defaulting to 6 to match prod.
- Closed umbrella issue: #11582 — Enforce (subrequest | service) limits during local dev
- Merged sibling work: #11803 — Add a new
subrequestslimit (addresses total subrequest count, not concurrent in‑flight) - Prod-side semantics discussion: workerd#4471 — Response closed due to connection limit
wrangler 4.84.0- macOS 25.2.0 (Darwin, arm64)
- Node 24.1.0