Skip to content

fix(solid): an SSR async memo's retry runs under its own render's context (#3972) - #3983

Merged
ryansolid merged 2 commits into
nextfrom
fix/ssr-retry-context-3972
Oct 12, 2026
Merged

ryansolid merged 2 commits into
nextfrom
fix/ssr-retry-context-3972

Conversation

@ryansolid

Copy link
Copy Markdown
Member

Fixes #3972 — fix and repro by @ibniss, applied as proposed.

The server async memo captures its render's sharedConfig.context at creation ("async re-computations may run after a concurrent request has overwritten sharedConfig.context") but run never reinstated it. A retry (subscribePendingRetry → update → run), and everything the pass creates — a children() memo it pulls, a slot's content — ran under whichever concurrent render set the context last, taking that render's hydration ids. run now sets the captured context around the pass and restores the previous one.

Test: packages/web/test/server/retry-render-context-3972.spec.tsx (the issue's repro): two concurrent renders of a layout whose children()-resolved slot waits on data; each slot is created under its own render's context. Fails without the fix.

Suites: web server config — the same 12 failures with and without the change (link-claim, diagnostics-server-scenario, server-functions-adapter-request: local build/compiler environment); packages/solid — the same one environment failure (cross-package-fields, no universal dist here). Size: server renderToString floor unchanged.

No public API change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LVm3wseHt9wRTY8LfPiHmQ


Generated by Claude Code

@changeset-bot

changeset-bot Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6f7aeba

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

This PR includes changesets to release 12 packages
Name Type
solid-js Patch
@solidjs/diagnostics Patch
@solidjs/element Patch
@solidjs/h Patch
@solidjs/html Patch
test-integration Patch
@solidjs/universal Patch
@solidjs/web Patch
todos-server-example Patch
@solidjs/babel-plugin Patch
@solidjs/compiler Patch
@solidjs/signals 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

@github-actions

github-actions Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Size (brotli, eager entry chunk)

scenario head vs base minified vs base minified vs recorded cap lazy chunks (not counted)
signals: core floor (createSignal/Memo/Effect/Root/flush) 7.44 KB 0 B 0 B +31 B 7.45 KB ✅
signals: + createStore 14.71 KB 0 B 0 B +9 B 14.71 KB ✅
signals: + isPending/latest 9.69 KB 0 B 0 B −100 B 9.73 KB ✅
app: render + one signal (the simple-app floor) 9.91 KB 0 B 0 B −39 B 9.94 KB ✅
app: hydrating (no stores) with Show/For/Loading/Errored/lazy 17.70 KB 0 B 0 B −650 B 17.93 KB ✅ lazy-page.js 0.04 KB
app: hydrating + every store primitive family 29.08 KB 0 B 0 B −580 B 29.27 KB ✅ lazy-page.js 0.04 KB
app: CSR with Show/For/Loading/Errored/lazy 12.95 KB 0 B 0 B −47 B 12.98 KB ✅ lazy-page.js 0.04 KB
app: CSR, observe tier (same app on the observe artifacts) 14.56 KB 0 B 0 B −31 B 14.56 KB ⚠️ over by 5 B, 51 B minified headroom lazy-page.js 0.04 KB
app: CSR, observe tier + attribution engine enabled 28.86 KB 0 B 0 B −1 B 28.91 KB ✅ lazy-page.js 0.04 KB
app: compiled floor (one template, one text hole, one delegated click) 10.10 KB 0 B 0 B −57 B 10.13 KB ✅
app: compiled CSR (JSX todo app: spread/merge/omit, events, class/style, keyed For, Show, Loading + lazy, store) 25.42 KB 0 B 0 B −34 B 25.46 KB ✅ stats.js 0.18 KB
app: compiled hydrating (the same JSX todo app through hydrate(), compiled hydratable) 31.16 KB 0 B 0 B −656 B 31.39 KB ✅ stats.js 0.20 KB
frames: eager client consumer (frames client + transport, lazy codec) 11.43 KB 0 B 0 B 0 B 11.43 KB ✅
page: base server components (hydrating + dynamic + frames + sf reference) 33.86 KB 0 B 0 B −2311 B 34.33 KB ✅ assets.js 0.78 KB, bind.js 1.83 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.80 KB, trace.js 8.78 KB, wire.js 0.93 KB
page: live server components (base + live/GET + action + isPending/latest) 37.57 KB 0 B 0 B −2440 B 38.15 KB ✅ assets.js 0.78 KB, bind.js 1.83 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.80 KB, trace.js 8.77 KB, wire.js 0.93 KB
page: compiled base server components (the base page as JSX: templates with class/style/attributes/events, For/Show; no spread) 34.72 KB 0 B 0 B −3476 B 35.66 KB ✅ assets.js 0.78 KB, bind.js 1.82 KB, decode.js 6.23 KB, regions.js 0.80 KB, sc-comments.js 0.20 KB, trace.js 8.74 KB, wire.js 0.93 KB
page: compiled live server components (the compiled base page + live/GET + action + isPending/latest) 40.31 KB 0 B 0 B −3545 B 41.21 KB ✅ eager (counted): web.js 21.32 KB; assets.js 0.78 KB, bind.js 1.83 KB, decode.js 6.23 KB, regions.js 0.79 KB, sc-comments.js 0.19 KB, trace.js 8.72 KB, wire.js 0.93 KB
page: base + router (base page + @solidjs/router: createRouter, two routes, preload, useNavigate) 41.21 KB 0 B 0 B −2317 B 41.79 KB ✅ assets.js 0.78 KB, bind.js 1.84 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.80 KB, server.js 1.02 KB, serverForms.js 3.59 KB, trace.js 8.79 KB, wire.js 0.94 KB
page: live + router (live page + @solidjs/router: createRouter, two routes, preload, useNavigate) 46.95 KB 0 B 0 B −2386 B 47.49 KB ✅ eager (counted): client.js 27.47 KB; assets.js 0.78 KB, bind.js 1.85 KB, decode.js 6.23 KB, lazy-page.js 0.04 KB, regions.js 0.81 KB, server.js 1.02 KB, serverForms.js 3.30 KB, trace.js 8.75 KB, wire.js 0.94 KB
server: floor (getRequestEvent + isServer) 1.33 KB 0 B 0 B 0 B 1.34 KB ✅
server: renderToString (the server-render floor) 20.40 KB 0 B 0 B +4 B 20.42 KB ✅

⚠️ Over the brotli cap within the minified allowance (passes)

  • app: CSR, observe tier (same app on the observe artifacts): over brotli cap by 5 B; minified 41,274 B vs 41,305 B recorded with the cap (−31 B) — 51 B of the 20 B minified allowance left; +0 B minified over this PR's base

Bundled with Rolldown (what Vite ships), brotli q11, decimal KB. A scenario fails only when it is over its brotli cap and its minified size is more than 20 B over the minified recorded with the cap; over the cap within that allowance is brotli layout noise and passes with a warning. Caps and their recorded minified in scripts/size/scenarios.js; the floor and page caps in floor-caps.json are frozen (lower only, or Size-Exception: in the PR body). npm run ratchet lowers caps per RC; it never raises one (scripts/size/README.md).

@codspeed

codspeed Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 8.39%

⚠️ 2 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 2 regressed benchmarks
✅ 193 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ createStore setter: delete + set one root key (#3044 overlay) 1.8 ms 2.1 ms -11.36%
❌ memo + sync render effect only (reference) 26.7 ms 28.2 ms -5.32%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing fix/ssr-retry-context-3972 (6f7aeba) with next (a24e911)

Open in CodSpeed

…text (#3972)

The memo captured its render's sharedConfig.context at creation but
`run` never reinstated it, so a retry (subscribePendingRetry -> update ->
run) and everything it created ran under whichever concurrent render set
the context last. Restore the captured context around the pass.

Fix and repro by @ibniss.

Fixes #3972

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVm3wseHt9wRTY8LfPiHmQ
…olidjs/web in the #3972 spec

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LVm3wseHt9wRTY8LfPiHmQ
@ryansolid
ryansolid force-pushed the fix/ssr-retry-context-3972 branch from 77d8e2c to 6f7aeba Compare October 11, 2026 20:31

Copy link
Copy Markdown
Member Author

Review at 6f7aeba2, against next (a24e911b). The fix is right and verified. One finding: three sibling retry paths have the same gap and are not covered.

Verified

  • The spec. retry-render-context-3972.spec.tsx passes with the change and fails with server/signals.ts reverted to next (rebuilt solid-js each way).
  • Types. @solidjs/web test-types passes locally at this head.
  • Server suite. 1,561 passed; one failure, server-functions-adapter-request.spec.tsx, which the description already lists as environmental and which this change doesn't touch.

Not covered: the other retry paths run under the wrong context too

Same two concurrent renders as the spec, with each primitive's compute recording sharedConfig.context on its first pass and on its retry:

primitive first pass retry
createMemo own render own render (fixed here)
createSignal(fn) own render own render
createRenderEffect own render the other render's
createProjection own render the other render's
createStore(fn) own render the other render's

The sites are the render effect's retry (it calls runWithOwner(owner, …) from source.then(retry)) and runProjection, which settleServerAsync re-runs through subscribePendingRetry. Both captured ctx at creation, as the memo did, and neither reinstates it. Anything those passes create takes the other request's slot store the same way. A compute there creates nodes less often than a memo does, so this is lower exposure than #3972, but it is the same hazard and the same three-line fix.

— Claude via Claude Code


Generated by Claude Code

@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 38172579889

Coverage remained the same at 77.429%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1321
Covered Lines: 1079
Line Coverage: 81.68%
Relevant Branches: 1036
Covered Branches: 746
Branch Coverage: 72.01%
Branches in Coverage %: Yes
Coverage Strength: 27.03 hits per line

💛 - Coveralls

@ryansolid
ryansolid merged commit a405039 into next Oct 12, 2026
7 of 8 checks passed
ryansolid added a commit that referenced this pull request Oct 12, 2026
…own render's context (#3984)

#3983 restored the creating render's sharedConfig.context around an async
memo's retry. The render effect's retry (ctx.block(source.then(retry)))
and a projection's re-derive (runProjection, re-run by settleServerAsync
through subscribePendingRetry; also createStore(fn) and
createOptimisticStore(fn)) captured the context at creation the same way
and never reinstated it, so under concurrent requests the retry ran under
whichever render set the context last. Both now set it around the pass,
the render effect's around its effect run too.

The #3972 spec gains one test per primitive: each pass, first and retry,
sees its own render's context. The render effect, projection,
createStore(fn) and createOptimisticStore(fn) cases fail on next.


Claude-Session: https://claude.ai/code/session_017PDt8Jv6uf5xRDsrux4UwF

Co-authored-by: Claude <noreply@anthropic.com>
@ryansolid
ryansolid deleted the fix/ssr-retry-context-3972 branch October 12, 2026 18:20
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