fix(motion): prevent callback leak on detaching VirtualClock - #3734
fix(motion): prevent callback leak on detaching VirtualClock#3734Unnati1007 wants to merge 1 commit into
Conversation
|
Warning Review limit reached
Next review available in: 9 minutes You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@Karanjot786 Please review the PR, do lemme know if any changes needed and merge it under GSSoC'26 |
|
Blocking — build-and-test fails on the PR own test (timer-pool.test.ts:120). Root cause: the migration loop (timer-pool.ts:96-103) never sets entry.active=false when moving a sub to the real pool, so the unsub closure takes the wrong branch and the callback stays registered — the exact leak claimed. Set active=false on migration. |
Description
This PR fixes a permanent interval/callback leak inside the
@termuijs/motiontimer coalescing pool. When aVirtualClockis detached, active subscriptions are migrated back to the real timer pool. However, their returnedunsubfunctions previously still pointed to the virtual clock's cleanup instead of the real timer pool. This PR tracks the active state of each subscription and correctly maps unsubscription back to the real pool when needed.Related Issue
Closes #3733
Which package(s)?
@termuijs/motion
Type of Change
type:bug)type:feature)type:docs)type:testing)type:refactor)type:design)type:accessibility)type:performance)type:devops)type:security)Checklist
needs-starcheck blocks your merge otherwise.bun vitest runbun run buildbun run typecheckCONTRIBUTING.md.type: short description.markDirty()(if your change affects rendering).anytypes without an inline comment explaining why.GSSoC 2026 Participation
https://gssoc.girlscript.org/profile/Unnati1007Screenshots / Recordings (UI changes)
N/A (This is a non-visual background backend timing pool leak fix).
Notes for the Reviewer
timer-pool.test.tsverifying that callingunsub()after detaching aVirtualClocksuccessfully unsubscribes the callback and cleans up the real timer intervals.