Skip to content

Fix Durable Object Loader capacity exhaustion and idle ownership - #149

Merged
elliothux merged 2 commits into
mainfrom
fix/issue146-loader-capacity
Oct 8, 2026
Merged

elliothux merged 2 commits into
mainfrom
fix/issue146-loader-capacity

Conversation

@elliothux

Copy link
Copy Markdown
Owner

Fixes #146.

Durable Object activations previously occupied the shared 64-entry named WorkerLoader cache, which also serves ordinary Worker dispatch and version validation. Load DO classes outside that cache and reuse them only within their owning DoHost activation. Replace the retained self actor stub with a private manager that resolves the host ID for each call, allowing native idle eviction without changing SQLite data or the workerd pin.

Preserve mixed RPC/fetch/CONNECT handler start order and overlapping requests through admission acknowledgements. Fetch and WebSockets keep native HTTP delivery; retained RPC callbacks are duplicated and released on use, cancellation, or expiry.

Validation:

  • Formally pinned workerd: the complete P0.7 matrix and a real-daemon regression with 129 objects, mixed cold RPC/fetch calls, 129 simultaneous hibernatable WebSockets, unrelated Worker validation/deployment/dispatch, alarms, and SQLite/identity recovery after daemon restart.
  • Native component probe: 129 successful alarm repairs, available ordinary dispatch/validation, and a new activation after 145 seconds idle with SQLite data preserved.
  • Runtime JavaScript: 424 tests; strict TypeScript, generated assets, formatting, lint, dependency boundaries, Rust Clippy, no-default-features, and Rust 1.98 MSRV passed.
  • Rust coverage: reuse of the validated 90.42% report after confirming byte identity of all 683 measured source files and unchanged coverage configuration.
  • Complete uninstrumented workspace Gate: failed in FastAPI after rollback and daemon restart (POST /echo returned 503 after about 30 seconds; expected 201). Django and Flask passed. The frozen run passed 1775 of 1842 selected cases before stopping. All 64 previously unexecuted cases have now passed once: 56 in a scoped nine-target development Gate and eight in the focused native service-process lifecycle partition. These separate runs do not constitute complete final acceptance. Under the user’s explicit closeout criterion, ten targeted A -> B -> A + complete-daemon-restart replays all passed without 503 (cold POSTs 7.3–12.9 seconds). The original FastAPI artifact corruption/recovery and cleanup assertions passed. The original root cause was not captured; complete final workspace acceptance has not been rerun.

Real Cloudflare differential and Linux release qualification were not run. The regression size is not a new object quota or an unlimited-capacity claim.

@elliothux
elliothux merged commit 6ebd701 into main Oct 8, 2026
11 checks passed
cursor Bot pushed a commit to charlzyx/open-compute that referenced this pull request Oct 15, 2026
workerd keeps about 64 named isolates per WorkerLoader namespace and does
not evict one that still has a request in flight. Closed issue elliothux#146 and
merged PR elliothux#149 move Durable Object class loads to unnamed get(null).
Ordinary Worker dispatch, service bindings, workflows, and validation
still use a named get, so a mixed burst still overflows that cache.

All of those loads now share tenant/0. getPrivate is called on the
current request because the channel is bound to that IoContext. The
factory still returns the same namespace. At most 48 named loads run at
once, leaving room under the 64-entry cap for an idle isolate to be
evicted. A capacity error that still escapes is HTTP 429.

Co-authored-by: ChaoGPT <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ~60–64 live Durable Objects stall the instance-wide workerd runtime without recovery

1 participant