Repository navigation
fix(miniflare): don't block the Node.js event loop in unsafeEvictDurableObject() - #17090
Conversation
🦋 Changeset detectedLatest commit: 76dcfae The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hi @pelle. Thanks for taking the time to contribute to Workers SDK. This PR has been automatically closed because you are not currently a registered (vouched) collaborator for this repository. AI tools now let our team generate proposed code changes quickly. Reviewing changes, checking that they solve the right problem, and maintaining code quality over time still take substantial care and effort. We therefore limit PRs to registered collaborators so we can focus that effort where it is most useful. For the majority of external contributors, the most effective way to help is through issues: describing a problem or use case, providing a minimal reproduction, investigating its cause, or helping us verify a fix. Those contributions help us understand what needs to change and are very welcome. We will take an initial look at this PR and decide whether it is something we want to invest time in reviewing and maintaining. We may reopen it if we decide to proceed, but we cannot guarantee that it will be reopened or receive a full review. |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
|
This pull request's reviews are posted as pull request reviews: see the review of |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
clanker review |
There was a problem hiding this comment.
✅ Approved — No issues found. The fix to make dev control calls async and the header fix for failed calls are correct and covered by tests.
The decision is advisory: this review is a comment and never approves, blocks or requests changes on the pull request.
✅ All checks passed
🔒 Security: ✅ LGTM
The change only alters how dev-control calls are dispatched (sync or async) and which header is set when a call fails. It adds no new trust boundary, input handling or secrets.
📖 AGENTS.md: ✅ LGTM
The change does not affect the repository's agent guidance.
📋 Code Quality: ✅ LGTM
The async forcing for evictDurableObject/execDurableObjectSql on the Fetcher target is correct. Both methods already return Promises, so no caller depends on a synchronous result. The try/finally sets rpcAwaited on rejection, so the client receives the Promise result-type header and surfaces the real error. The new tests cover both paths with loose timing thresholds.
⚡ Performance: ✅ LGTM
Moving these calls off Atomics.wait() removes the main-thread freeze. It adds no new overhead.
📝 Documentation: ✅ LGTM
The changeset is present and the code comments explain why the change is needed.
Reviewed commit: 76dcfaea
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
Fixes #17089.
unsafeEvictDurableObject()(andexecDurableObjectSql()) call theDevControlservice through the proxy client. For non-Durable-Object targets that call is synchronous and blocks the Node.js main thread inAtomics.wait(). Eviction waits for the Durable Object'swaitUntil()work, so if that work is waiting on Node.js (a function-valued service binding,node-handler, ...), neither side can proceed until workerd's 30s timeout.Found with cloudflake (deterministic simulation testing for Workers): its Durable Object nemesis evicts objects at random points while a workload runs, with several Miniflare instances in one Node.js process. Seeds that evicted a Durable Object during background
waitUntil()work reproduced the 30s timeout every time, plus collateral failures in sibling instances during the freeze.Changes:
proxy/client.ts+core/constants.ts:isDevControlCall()forces dev control calls onto the async path, like Durable Object stubs.core/proxy.worker.ts: an awaited RPC call that rejects now still gets thePromiseresult-type header. Before, only the success path set it, so an async call that threw (e.g. evicting a Durable Object that is not running) hitassert(typeHeader === "Promise")in the client instead of surfacing the real error.Tests (
test/index.spec.ts):waitUntil()work that awaits anode-handlercompletes in ~0.4s with Node.js timers still ticking (fails with the 30s timeout without the fix)Verified locally:
vitest run test/index.spec.ts test/plugins/corepasses (202 passed, 1 skipped).Note
This PR was prepared with Claude Code (Claude Sonnet 5.5) on behalf of the submitter, who asked for it to be filed.