Skip to content

fix(worker): release pending handlers after errors - #838

Open
OskarEichler wants to merge 1 commit into
krisk:mainfrom
OskarEichler:codex/worker-pending-cleanup
Open

fix(worker): release pending handlers after errors#838
OskarEichler wants to merge 1 commit into
krisk:mainfrom
OskarEichler:codex/worker-pending-cleanup

Conversation

@OskarEichler

Copy link
Copy Markdown

Fix

Release pending-call handlers after worker failures.

  • Clear the pending map after the existing worker-error handler rejects outstanding calls.
  • Remove the individual entry when postMessage throws synchronously, such as a DataCloneError. The Promise already rejects in this case, but the map currently retains its resolve/reject closures.

Before this change, a clone failure leaves one settled entry retained; two pending calls followed by a worker error leave two. Repeated failures accumulate these entries until termination or a reply that may never arrive.

No changes to search scoring, ranking, options, worker-error rejection scope, or public APIs. No breaking changes. This fixes cleanup only; it does not add worker restart/recovery behavior.

Verification

  • All 449 existing tests across 22 files pass.
  • All package builds, source type checking, lint, targeted formatting, and git diff --check pass.
  • Inline checks cover 100 successive clone failures, worker-error rejection/cleanup, late replies, normal replies, remote errors, and termination. All settled-call checks leave the pending map empty.
  • Failure reproduction uses a worker stub with real structuredClone validation; no real-browser worker lifecycle testing is claimed.
  • No test files were added or changed.

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.

1 participant