Repository navigation
fix(platform-cloudflare): awaitProgress re-issues after a transient reset - #63
Merged
Merged
Conversation
…eset A Durable Object reset reaches the waiting client as a plain remote rejection, an overload-flagged rejection, or an answer that cannot be decoded, not only as a rejection flagged as a reset. The wait observes durable state, so every such transport failure leaves the attempt with nothing observed and the same attempt budget can re-issue it; typed host failures stay terminal. Without this, the client wait ended on the reset and no subscription reached the fresh incarnation, so a caller awaiting progress never saw it reconnect. The eviction test now races the reconstructed-waiter latch against the client wait's join, so a client wait that ends early surfaces its own error instead of parking until the test cap. Timeout, assertions and the attempt budget are unchanged.
…erminal The wait re-issued every transport failure, including one the runtime flagged as overloaded. That shape is marked as not worth retrying because a retry adds load to an object that cannot keep up, so it stays terminal; the bare remote rejection of a reset and an answer that cannot be decoded still re-issue.
…-issues it The solution doc said an in-flight awaitProgress call survives state.abort() and is replayed on the fresh incarnation, so the client's retry never runs. Measured otherwise: the reset rejects the call with remote and durableObjectReset set, and workerd does not replay it, which is why the client re-issues and why a test that waits for the fresh incarnation's subscription stalls when that re-issue does not happen.
Contributor
Author
|
Known residual, recorded at merge: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happened
test/progress-wait.test.ts > #94 Cloudflare durable progress wait > reconnects after eviction, reconstructs the wait, and rechecks durable authoritytimed out at 20000ms on main at 1ea54e8. The step that never resolved was the test's own subscription latch; the client's wait had already ended.Cause
packages/platform-cloudflare/src/CloudflareThreadClient.ts:888-899(before this change): the retry re-issued only when the rejection was flaggedretryable === true && overloaded !== true, and did not handle an answer that cannot be decoded.packages/platform-cloudflare/test/progress-wait.test.ts:164(before this change): after the abort the test awaited the reconstructed-waiter latch, which waits forawaitProgressSubscribedAfteron the new incarnation.state.abort()rejects an in-flight RPC and the platform does not replay it on the fresh incarnation (measured:remote=trueanddurableObjectReset=trueon 200/200 plain RPC probes and 160/160 through the client path). Not every rejection carries those flags: a bare remote rejection, an overload-flagged rejection, and an answer cut off mid-write (undecodable) each arrive at the client in a different shape. The old predicate re-issued only the flagged shape, so in the others the client wait ended at once and no subscription ever reached the new incarnation. With no subscription to bind, the latch never resolved and the test ran to its cap.Proof
awaitProgressexactly once and failed (no re-issue); only the reset-flagged rejection re-issued and then succeeded.Change
ThreadClientErrorfrom a bare remote rejection of a reset, and aHostProtocolErrorfrom an answer that cannot be decoded, now re-issue. An overload-flagged rejection stays terminal, because the runtime marks that shape as not worth retrying (a retry adds load to an object that cannot keep up), and typed host failures (ThreadStoreError,ThreadNotMaterialized,OperationDenied) stay terminal. The attempt budget, the schedule and every timeout are unchanged; no retry or sleep was added.@systemfsoftware/agent-platform-cloudflare.docs/solutions/test-failures/cross-object-test-work-outlives-the-workerd-environment.md, which said an in-flight wait survives a reset and is replayed on the fresh incarnation; the measurement shows the reset rejects it and workerd does not replay it, so the client must re-issue.Verification
exit 0, 3/3 tests; 12 consecutive runs of that file alone before the review fix, and 10 after it, all exit 0.
Package typecheck rc=0; repo lint: 0 warnings, 0 errors, rc=0;
dprint checkon the changed files rc=0.