Skip to content

EW-9182 Add assertion to detect timeout ID generator mismatches#3867

Merged
harrishancock merged 2 commits intomainfrom
harris/EW-9182-timeout-id-generator-assertion
Nov 5, 2025
Merged

EW-9182 Add assertion to detect timeout ID generator mismatches#3867
harrishancock merged 2 commits intomainfrom
harris/EW-9182-timeout-id-generator-assertion

Conversation

@harrishancock
Copy link
Collaborator

Add instrumentation to verify that the TimeoutId::Generator being used belongs to the ServiceWorkerGlobalScope associated with the current IoContext. This will help diagnose potential timeout ID collisions caused by generators being used with the wrong IoContext.

  • Add getTimeoutIdGenerator() method to Worker::Lock
  • Add assertion in TimeoutManagerImpl::setTimeout to validate generator
  • This will fail early with a descriptive error if the invariant is violated

🤖 Generated with Claude, then lightly edited by Harris Hancock.

Add instrumentation to verify that the TimeoutId::Generator being used belongs
to the ServiceWorkerGlobalScope associated with the current IoContext. This will
help diagnose potential timeout ID collisions caused by generators being used
with the wrong IoContext.

- Add getTimeoutIdGenerator() method to Worker::Lock
- Add assertion in TimeoutManagerImpl::setTimeout to validate generator
- This will fail early with a descriptive error if the invariant is violated

🤖 Generated with Claude, then lightly edited by Harris Hancock.

Co-Authored-By: Claude <noreply@anthropic.com>
@harrishancock harrishancock requested review from a team as code owners April 3, 2025 14:48
@anonrig
Copy link
Member

anonrig commented Apr 8, 2025

Couple of tests seem to be failing

@harrishancock harrishancock merged commit 746c8f0 into main Nov 5, 2025
21 of 22 checks passed
@harrishancock harrishancock deleted the harris/EW-9182-timeout-id-generator-assertion branch November 5, 2025 11:15
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.

3 participants