Skip to content

fix(signals): release disposed nodes from idle pending queue - #4254

Merged
ryansolid merged 1 commit into
solidjs:nextfrom
steipete:fix/idle-pending-retention
Oct 25, 2026
Merged

ryansolid merged 1 commit into
solidjs:nextfrom
steipete:fix/idle-pending-retention

Conversation

@steipete

Copy link
Copy Markdown

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-phase runWithOwner queueing, 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.
  • A flush-count probe against the built development, production and observe runtimes (new idle disposal / drained idle disposal / effect disposal / effect-phase runWithOwner queueing): base 0/0/1/1 → 1/0/1/2. The two increases are the intended drains; the runWithOwner case also leaks on the base.
  • node scripts/size/size.mjs + scripts/size/gate.mjs on 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 (and coverage): 5,549 passed, 2 expected failures, 2 skipped.
  • pnpm --dir packages/solid test --maxWorkers=1: 893 passed. packages/web client 1,438 passed; server 1,790 passed (3 expected failures).
  • packages/web hydration (JSX_COMPILER=babel, vite.config.hydrate.mjs): 519 passed; the one failure, C9 (b) container-trace arg with a delivered snapshot…, also fails on b1543ebe without this change (it passed in another run, so it may be flaky).

@changeset-bot

changeset-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c318457

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 15 packages
Name Type
@solidjs/signals Patch
test-integration Patch
@solidjs/web Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
solid-js Patch
@solidjs/universal Patch
board-example Patch
canvas-example Patch
server-dbmon-example Patch
todos-server-example Patch

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

@codspeed

codspeed Bot commented Oct 25, 2026

Copy link
Copy Markdown

Merging this PR will improve performance by 14.55%

2 warnings

⚠️ 4 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
✅ 195 untouched benchmarks
⏩ 5 skipped benchmarks1

Performance Changes

Benchmark BASE HEAD Efficiency
⚡ memo + sync render effect only (reference) 34 ms 29.7 ms +14.55%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing steipete:fix/idle-pending-retention (c318457) with next (253561e)

Open in CodSpeed

Footnotes

  1. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@ryansolid
ryansolid merged commit 2d9c9aa into solidjs:next Oct 25, 2026
8 checks passed
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.

2 participants