Skip to content

fix: harden cancellation binding lifecycle - #19

Merged
miinhho merged 2 commits into
mainfrom
perf/constant-time-cancellation
Sep 12, 2026
Merged

miinhho merged 2 commits into
mainfrom
perf/constant-time-cancellation

Conversation

@miinhho

@miinhho miinhho commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • avoid installing external cancellation listeners or deadline timers after a Job has already committed to cancellation
  • stop admitting later cancellation sources when an earlier source aborts reentrantly during registration
  • replace recursive descendant cancellation with an iterative traversal so deep ownership chains cannot exhaust the JavaScript call stack
  • cover cold cancellation, shared-source deduplication, losing-source cleanup, cancellation while draining children, and an 8,000-level ownership chain

Follow-up hardening from the cancellation lifecycle audit after #18.

Verification

  • pre-fix deep-chain reproduction: RangeError: Maximum call stack size exceeded
  • pnpm exec vitest run tests/job-cancellation.test.ts — 16 tests
  • pnpm format
  • pnpm check
  • pnpm build
  • pnpm test — 10 files, 118 tests
  • pnpm pack

@miinhho
miinhho merged commit 15239b2 into main Sep 12, 2026
1 check passed
@miinhho
miinhho deleted the perf/constant-time-cancellation branch September 12, 2026 03:53
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