Skip to content

TypeError: Cannot close a writable stream that is closed or errored #18228

@huseeiin

Description

@huseeiin

How can we reproduce the crash?

this is a compiled solid-js streaming ssr app:

import { renderToStream, ssr, ssrHydrationKey } from "solid-js/web";
var _tmpl$ = ["<h1", ">Home</h1>"];
function App() {
  return ssr(_tmpl$, ssrHydrationKey());
}
Bun.serve({
  fetch(req) {
    const {
      readable,
      writable
    } = new TransformStream();
    renderToStream(App).pipeTo(writable);
    return new Response(readable);
  }
});

this only happens when a request is aborted before the stream finishes. best way to reproduce it is running a benchmark and pressing ctrl+c to close it before it finishes.

this also happens in node:http:

error: Stream is already ended
code: "ERR_STREAM_ALREADY_FINISHED"

Stack Trace (bun.report)

Bun v1.2.6-canary (ba7f593) on linux x86_64 [AutoCommand]

Segmentation fault at address 0x02A6E820

Features: tsconfig, tsconfig_paths, abort_signal, http_server, jsc

Sentry Issue: BUN-EAX

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashAn issue that could cause a crashlinuxAn issue that occurs on Linuxnode:streamruntime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions