You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 9338c00
Browse filesBrowse the repository at this point in the historyBrowse files
authored
fix(web): createSSRResponse tears the render down on body cancel and pre-flush redirect (#3768) (#3772)
The body's cancel() and the pre-flush redirect branch only set a local
`closed` flag, so writes were dropped silently: nothing threw, guardSink
never reached abandon("sink"), and the render kept resolving fragments and
pulling serialized async iterators for nobody.
pipe() now hands the render's teardown to createSSRResponse's sink through
a module-private symbol (the reverse of SHELL_ABANDONED). The body's
cancel() calls it as a "consumer" disconnect, the same reason and finding
as cancelling the readable view; a cancel after end() (queued chunks
draining) is a no-op. A pre-flush redirect tears down quietly, with no
SSR_STREAM_ABANDONED finding, because the response discarded the page
and nobody left. Both settle the render record as "abandoned".
Co-authored-by: Claude via Cursor <[email protected]>
Co-authored-by: Cursor <[email protected]>
`createSSRResponse` over a stream result now tears the render down when nobody will read it (#3768). Cancelling the resolved body (the client went away, a HEAD request whose body the host cancels) disposes the render through `renderToStream`'s disconnect path, as cancelling its `readable` does: every async source still being pulled is returned, `onCleanup` runs, and nothing more is written. This emits `SSR_STREAM_ABANDONED` with `data.reason: "consumer"`. A pre-flush `Location` (a bodyless redirect) tears the render down the same way, as the JSDoc already said, but without the finding, because nobody left. Previously both only dropped writes, and the render ran on until its sources happened to end. The render's observe record settles as `"abandoned"` in both cases.
Copy file name to clipboardExpand all lines: documentation/solid-2.0/08-dev-diagnostics.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -589,7 +589,7 @@ Finding (`warn`, observe + dev). A fragment failed while descendants of it were
589
589
590
590
**Message:** "[SSR_STREAM_ABANDONED] The response stream was abandoned mid-render (consumer) with 4 fragment(s) still pending; the render was torn down."
591
591
592
-
Finding (`warn`, observe + dev; no `ownerPath` — a stream event). The consumer cancelled (`data.reason: "consumer"`, a `pipeTo` cancellation — usually the browser navigating away), the sink failed on write (`"sink"`), or the request's `signal` aborted (`"signal"` — `renderToStream`'s `signal` option; how a frame-stream response, whose render never touches the document writable, learns its reader is gone, from its body's `cancel` or the request's abort) while fragments were pending, and the render was torn down. `data.shellFlushed` says whether the shell had gone out; `data.pendingFragments` counts what never shipped. Not an error in the app; at volume it is the request cost of renders nobody waited for.
592
+
Finding (`warn`, observe + dev; no `ownerPath` — a stream event). The consumer cancelled (`data.reason: "consumer"`, a `pipeTo` cancellation or a cancelled `createSSRResponse` body — usually the browser navigating away), the sink failed on write (`"sink"`), or the request's `signal` aborted (`"signal"` — `renderToStream`'s `signal` option; how a frame-stream response, whose render never touches the document writable, learns its reader is gone, from its body's `cancel` or the request's abort) while fragments were pending, and the render was torn down. A pre-flush redirect through `createSSRResponse` tears the render down too, without this finding: the page was discarded, nobody left. `data.shellFlushed` says whether the shell had gone out; `data.pendingFragments` counts what never shipped. Not an error in the app; at volume it is the request cost of renders nobody waited for.
One record per render, delivered when it **ends**: the document returned, the stream's last fragment written, or the render torn down. `at` is `performance.now()` at the render's start; `shellMs` runs start → the shell complete — for a stream, the head and shell handed to the sink (the head is frozen from there; a fragment can no longer add to it), for a string, the document assembled (the whole render) — and is absent when the render ended before its shell; `durationMs` runs start → the end. `boundaries` counts the `<Loading>` boundaries the shell **waited on** — each also a `"boundary"` record with `streamed: false` — and not the ones that streamed after it; it is counted from the boundary records the render filed, so in an observe build it needs a `"boundary"` listener too (`0` with a `"render"` listener alone). `outcome` is `"complete"` for a render that ran to its end, `"abandoned"` when the consumer left mid-stream (the `SSR_STREAM_ABANDONED` finding is that request's account), `"error"` when the render failed (a string render threw; a stream's uncontained failure wound it down). `live.event` is the request the render served, absent for a render outside a request scope; `live.trace` is the render's trace context (what `getTraceContext()` answers during it). `solid-shell` on the response's `Server-Timing` is this record's `shellMs`, read off the same object at head commit (below, [Chrome Performance panel](#chrome-performance-panel-solidjswebperformance-tracks)). The cost is paid only with a listener installed (or in dev): a render nobody observes reads no clock. `route` is the route the render resolved to, as the router declared it while building its context under this render (`OBSERVE.attribution.withOrigin` with an `initial` ref — the same call that opens the client's first `"navigation"` record): `name` the matched pattern (`/users/:id`), `to` the concrete path, `params` what it bound; read from the router's ref when the render settles, so a match refined during the render is what lands, and absent when no router declared one. It is the name a consumer gives the request (`http.route`), where the URL would scatter one page across as many names as it has parameters.
840
+
One record per render, delivered when it **ends**: the document returned, the stream's last fragment written, or the render torn down. `at` is `performance.now()` at the render's start; `shellMs` runs start → the shell complete — for a stream, the head and shell handed to the sink (the head is frozen from there; a fragment can no longer add to it), for a string, the document assembled (the whole render) — and is absent when the render ended before its shell; `durationMs` runs start → the end. `boundaries` counts the `<Loading>` boundaries the shell **waited on** — each also a `"boundary"` record with `streamed: false` — and not the ones that streamed after it; it is counted from the boundary records the render filed, so in an observe build it needs a `"boundary"` listener too (`0` with a `"render"` listener alone). `outcome` is `"complete"` for a render that ran to its end, `"abandoned"` when the consumer left mid-stream (the `SSR_STREAM_ABANDONED` finding is that request's account) or `createSSRResponse` discarded the page for a pre-flush redirect (no finding), `"error"` when the render failed (a string render threw; a stream's uncontained failure wound it down). `live.event` is the request the render served, absent for a render outside a request scope; `live.trace` is the render's trace context (what `getTraceContext()` answers during it). `solid-shell` on the response's `Server-Timing` is this record's `shellMs`, read off the same object at head commit (below, [Chrome Performance panel](#chrome-performance-panel-solidjswebperformance-tracks)). The cost is paid only with a listener installed (or in dev): a render nobody observes reads no clock. `route` is the route the render resolved to, as the router declared it while building its context under this render (`OBSERVE.attribution.withOrigin` with an `initial` ref — the same call that opens the client's first `"navigation"` record): `name` the matched pattern (`/users/:id`), `to` the concrete path, `params` what it bound; read from the router's ref when the render settles, so a match refined during the render is what lands, and absent when no router declared one. It is the name a consumer gives the request (`http.route`), where the URL would scatter one page across as many names as it has parameters.
841
841
842
842
The **`"call"` record** (from `@solidjs/web`, client) is one server-function call made from the browser — the invocation's twin, seen from the caller's end:
0 commit comments