Skip to content

STOR-5615: Apply retry policy to JSRPC calls - #7513

Merged
apeacock1991 merged 2 commits into
mainfrom
apeacock/STOR-5615-jsrpc-retry-policy
Sep 25, 2026
Merged

apeacock1991 merged 2 commits into
mainfrom
apeacock/STOR-5615-jsrpc-retry-policy

Conversation

@apeacock1991

@apeacock1991 apeacock1991 commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

JSRPC calls to Durable Objects now retry the same way fetch does.

  • When the durable-object-retries-userland gate is on, JSRPC uses the binding's retry policy (maxAttempts, timeoutMs). Otherwise it uses the default policy.
  • Retries are enforced only when the fetch and JSRPC retry gates and their retry-request gates are all on.
  • A retry still in flight when the retry timeout expires is cancelled and fails with the original disconnect. This includes an established session with a pending call. Calls pipelined on that retry are rejected too.
  • The first attempt is never cancelled.

Default change

As with fetch in #7383, in-flight cancellation also applies to the default policy when those gates are on.

Output gate

The second commit aligns JSRPC with fetch:

  • Only the first attempt waits for the output gate. A retry resends the same payload, which that wait already cleared.
  • The retry timeout starts once the first attempt clears the gate, so time spent behind the actor's own earlier writes doesn't count against it.

@ask-bonk

ask-bonk Bot commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

LGTM

github run

@apeacock1991
apeacock1991 force-pushed the apeacock/STOR-5615-jsrpc-retry-policy branch 2 times, most recently from db36e80 to 87a6dca Compare September 24, 2026 21:26
@apeacock1991
apeacock1991 marked this pull request as ready for review September 24, 2026 21:29
@apeacock1991
apeacock1991 requested review from a team as code owners September 24, 2026 21:29
JSRPC calls to Durable Objects use the binding's retry policy
when the userland gate is on and the binding configures one.
Otherwise they use the runtime default. The fetch and JSRPC
retry gates and their retry-request gates must all be on to
enforce retries.

When the timeout expires, an in-flight retry is cancelled and
fails with the original disconnect; pipelined calls reject too.
This includes established sessions with a pending receiver call.
Cancel the session only after the timeout wins the result race,
so session revocation cannot replace the original disconnect.
The first attempt is never cancelled.

JSRPC starts the retry timeout when it creates the retry state,
before any output-gate wait. Fetch starts it after that wait.
@apeacock1991
apeacock1991 force-pushed the apeacock/STOR-5615-do-retry-policy-config branch from 6e19966 to badef8b Compare September 24, 2026 21:41
@apeacock1991
apeacock1991 force-pushed the apeacock/STOR-5615-jsrpc-retry-policy branch from 87a6dca to 7f87ae3 Compare September 24, 2026 21:41
@github-actions

github-actions Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

Comment thread src/workerd/api/worker-rpc.c++ Outdated
Base automatically changed from apeacock/STOR-5615-do-retry-policy-config to main September 25, 2026 07:52
Only the first attempt of a JSRPC call to a Durable Object now
waits for the output gate. A retry resends the same payload, which
that wait already cleared, so it no longer waits again. Fetch
retries already work this way. Waiting again held retries behind
later, unrelated writes and spent their retry budget.

The retry timeout now starts once the first attempt clears the
output gate, as it does for fetch. Before, time spent behind the
actor's own earlier writes counted against the timeout.
@apeacock1991
apeacock1991 merged commit a5e123b into main Sep 25, 2026
28 checks passed
@apeacock1991
apeacock1991 deleted the apeacock/STOR-5615-jsrpc-retry-policy branch September 25, 2026 19:07
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.

2 participants