[🐞] `send(new Response(stream))` drops its `pipeTo` promise; a failed stream or a client that leaves exits a Bun server
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 75/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- bun, typescript
Direzione di ricerca
Leggi packages/qwik-router/src/middleware/request-handler/request-event-core.ts, in particolare send, e verifica come vengono gestite le promesse di pipeTo, write e close. La riproduzione nell’issue include sia uno stream in errore sia una disconnessione del client; usala per verificare che il server rimanga attivo dopo entrambi i casi.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Which component is affected?
Qwik Router
Describe the bug
send() in the request event starts the write and does not wait for it or handle its failure. With a Response body it calls statusOrResponse.body.pipeTo(writableStream) and drops the returned promise; with a status and a body it drops the writer.write(...) and writer.close() promises the same way (packages/qwik-router/src/middleware/request-handler/request-event-core.ts, send).
When the pipe rejects, nothing handles the rejection. On Bun an unhandled rejection ends the process, so one failed streamed response takes the whole server down:
- The body stream errors (for example, an upstream the route is proxying resets its connection):
error: <the stream's error>, exit code 1. - The client leaves while the body is still streaming (closed tab,
curl --max-time):AbortError: The connection was closed., exit code 1.
Any route that answers with send(new Response(stream)) is exposed (server-sent events, a proxied fetch body). In production this showed up as server processes exiting about a minute after a browser left a live feed.
Reproduced on 2.0.0-rc.4 and still present on main (a96a5fd25a, read 2026-11-06). I only tested Bun 1.4.4.
A one-line change makes both cases survive in the reproduction: handling the rejection of that pipeTo(...) (.catch(() => {}), or routing it to the request's error handling) keeps the server alive. I checked this by editing the built server of the reproduction. The write()/close() promises in the numeric branch need the same treatment.
Reproduction
https://github.com/ixcans/qwik-send-pipe-repro
Steps to reproduce
git clone https://github.com/ixcans/qwik-send-pipe-repro
cd qwik-send-pipe-repro
pnpm install
pnpm build
./check.sh
check.sh starts the built server, makes one request to /stream/?mode=error and one to /stream/?mode=endless (each against a fresh server), and reports whether the server is still alive:
mode=error curl exit=56 http=200 server alive after: NO (exit 1)
mode=endless curl exit=28 http=200 server alive after: NO (exit 1)
The only route is src/routes/stream/index.ts, which calls send(new Response(body)).
System Info
@qwik.dev/router 2.0.0-rc.4
@qwik.dev/core 2.0.0-rc.4
vite 8.3.6
bun 1.4.4 (Linux arm64)
adapter: @qwik.dev/router/adapters/bun-server
- Lingua principale
- TypeScript
- Stelle
- 22.1k
- Fork
- 1.4k
- Merge medio
- 2g 6h
- PR unite (30g)
- 96
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di QwikDev/qwik
-
[🐞] SSG: "Qwik Router SSG was skipped" warning on every SSG build, while pages are prerenderedForse già presa @itsnjstyle27 l’ha presa 4 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
docs router V2
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
DX enhancement V2
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
QwikDev/qwik#8480 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 52/100
I maintainer di solito rispondono entro 1 giorno
-
[🐞] A layout's loader request runs the loaders of the page at the layout's path as guards: a redirect there bounces client navigations in productionForse già presa @bercedev l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 46/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di QwikDev/qwik
Issue simili
-
code-quality good-first-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
OpenRailAssociation/netzgrafik-editor-frontend#1481 ·
I maintainer di solito rispondono entro 1 giorno
-
bug implicit-state
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
-
area:models enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug frontend ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Recording drops clicks on links, filters and checkboxes that share a form with a search fieldForse già presa @columbia11 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
Tencent/BrowserSkill#657 ·
I maintainer di solito rispondono entro 1 giorno