Repository navigation
fix(signals): release disposed nodes from idle pending queue - #4254
Conversation
🦋 Changeset detectedLatest commit: c318457 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 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 |
Merging this PR will improve performance by 14.55%2 warnings
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
AI-assisted: prepared and reviewed with AI coding agents; the results below come from the commands shown.
Summary
A disposed computation queued while no flush is scheduled can be retained until an unrelated write schedules a flush (indefinitely while the app stays idle). This can happen when created outside a flush, queued during the effect phase, or queued by status propagation from an idle rejection.
Schedule the existing drain when the pending queue has entries. Queue membership matters because readers queued by a rejected source never get
CONFIG_STAGED, and in-flight nodes keep that flag after their commit has removed them from the queue. Existing transaction and stale-reader conditions stay intact;schedule()coalesces pending requests. This fixes idle disposal, effect-phaserunWithOwnerqueueing, and cross-root rejection retention.How did you test this change?
pnpm --dir packages/signals exec vitest run tests/gc.test.ts --maxWorkers=1: both new cases (idle disposal and cross-root rejection) fail on the base and pass with the fix, without--expose-gc. They force two inspector collections and check a collectable control object.runWithOwnerqueueing): base 0/0/1/1 → 1/0/1/2. The two increases are the intended drains; therunWithOwnercase also leaks on the base.node scripts/size/size.mjs+scripts/size/gate.mjson base and head: all 22 scenarios pass with no cap changes. Core floor +10 minified B, +0 Brotli B.pnpm --dir packages/signals test --maxWorkers=1(andcoverage): 5,549 passed, 2 expected failures, 2 skipped.pnpm --dir packages/solid test --maxWorkers=1: 893 passed.packages/webclient 1,438 passed; server 1,790 passed (3 expected failures).packages/webhydration (JSX_COMPILER=babel,vite.config.hydrate.mjs): 519 passed; the one failure, C9(b) container-trace arg with a delivered snapshot…, also fails onb1543ebewithout this change (it passed in another run, so it may be flaky).