Repository navigation
[workflows-shared] Cancel completed step timeout timers - #15939
dario-piotrowicz merged 6 commits into
Conversation
Pass the step abort signal into scheduler.wait so workerd clears the native timer when a step finishes, instead of accumulating until the 10-minute deadline and hitting the 10,000-timer quota.
🦋 Changeset detectedLatest commit: 2bab1fe 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 |
|
Codeowners approval required for this PR:
Show detailed file reviewers
|
@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: |
Failed attempts only dropped the timeout PQ entry, so the native scheduler.wait timer leaked until the original deadline. Abort the attempt controller on the error path so long local workflows stay under the isolate timer quota.
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Thank you very much for the fix @00200200 🙏
The change looks overall good to me (and I manually validated that this fixes the issue), but could you please address devin's comments? 🙏
|
@dario-piotrowicz failed-step timers were already aborted in d08c975. I tightened the quota test so it no longer swallows unexpected errors (e.g. timer exhaustion). |
|
@dario-piotrowicz Updated with the fix for paused recovered sleep entries in 2bab1fe. All vitest suites pass cleanly. |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
LGTM, thanks again @00200200 😄
Once @Caio-Nogueira approves we can merge this! 😄
|
Codeowners approval required for this PR:
Show detailed file reviewers |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
…lpha (#879) ## pnpm-workspace.yaml (default) ## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `miniflare` | 5.20261006.0-alpha | 5.20261006.1-alpha | prerelease | ## Release Notes <details> <summary><b>miniflare</b> (5.20261006.0-alpha → 5.20261006.1-alpha)</summary> ### Patch Changes - [#16139](cloudflare/workers-sdk#16139) [`2d1d563`](cloudflare/workers-sdk@2d1d563) Thanks [@<!---->cpojer](https://github.com/cpojer)! - Update esbuild to 0.28.2 Align esbuild dependency with tooling using the latest 0.28 patch so package managers can share one installation instead of downloading a second native binary. - [#15939](cloudflare/workers-sdk#15939) [`e6f7663`](cloudflare/workers-sdk@e6f7663) Thanks [@<!---->00200200](https://github.com/00200200)! - Fix local Workflows hitting the timer quota on long runs Long local workflows no longer fail from timer exhaustion. Step timeout timers, sleep, waitForEvent, and grace-period waits now cancel their underlying timers when finished or aborted, instead of remaining until their original deadlines. - [#16098](cloudflare/workers-sdk#16098) [`fe607f9`](cloudflare/workers-sdk@fe607f9) Thanks [@<!---->dependabot](https://github.com/apps/dependabot)! - Update dependencies of "miniflare", "wrangler" The following dependency versions have been updated: | Dependency | From | To | | ---------- | ------ | ------ | | sharp | 0.35.4 | 0.35.5 | - [#15879](cloudflare/workers-sdk#15879) [`8de6b3c`](cloudflare/workers-sdk@8de6b3c) Thanks [@<!---->dawNotPoi](https://github.com/dawNotPoi)! - Stop Hyperdrive proxy listeners from accumulating across local development reloads Miniflare now reuses a listener when a Hyperdrive binding keeps the same target and closes listeners no longer used after a configuration update. Changing or removing a binding, including switching to `sslmode=disable`, no longer leaves stale listening ports in `wrangler dev`. - [#16106](https://github.com/cloud …[full notes](https://github.com/cloudflare/workers-sdk/releases/tag/miniflare%405.20261006.1-alpha) </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixes #15788
Local Workflow
step.do()starts a 10-minutescheduler.wait()for the step timeout. Completing the step aborted a JS controller and removed the priority-queue entry, but the native wait was started without{ signal }, so workerd kept the timer until the original deadline. After 5,000 sequential immediate steps that hits the isolate's 10,000-timer quota (QuotaExceededError).schedulerWait()now forwards the abort signal toscheduler.wait(), and the step timeout wait uses the combined step/engine abort signal. When the step finishes, workerd cancels the native timer.Note
This is a contribution from an AI agent: Cursor Grok 4.6.