A crash in the task that continues `HttpClient.send` is lost
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 68/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, node.js
- Ambito
- backend
Direzione di ricerca
Start with the HttpClient.send implementation and its fetch promise chain, focusing on the .then and .catch callbacks that invoke the scheduler. Reproduce the issue with src/Main.gren and run.sh, then add coverage using a task that throws after the response. Done means that task crash is reported normally and is not converted into a failed request or silently discarded.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Repository: gren-lang/node
Found against: gren 0.6.6, gren-lang/core 7.6.0, gren-lang/node 6.2.0
(and main at 982f87c), node 2
Summary
_HttpClient_request answers the scheduler from inside fetch's promise
chain, and the chain ends in a .catch that turns an error into a failed
request:
fetch(...)
.then((res) => { ... return callback(__Scheduler_succeed(...)); })
.catch((e) => { ... return callback(__Scheduler_fail(...)); });
callback steps the process there and then, so the task that continues the
response runs inside the .then. A crash there, a Debug.todo or a throw from
kernel code, is caught by the .catch as though the request had failed. The
second callback finds the binding already answered, and the crash is gone:
the program ends with nothing on stderr.
task after send |
prints | should print |
|---|---|---|
Task.andThen (\_ -> Debug.todo "after the response") |
nothing | Error: TODO in module \Main` on line 19` |
the same, after Task.succeed {} in place of the request |
Error: TODO in module \Main` on line 19` |
the same |
Reproduction
~/prj/gren-bug-reports/2026-10-12-httpclient-crash-after-response: ./run.sh
builds and runs src/Main.gren under devbox, which provides gren 0.6.6 and
node 22:
main : Node.SimpleProgram a
main =
Node.defineSimpleProgram <| \env ->
Init.await HttpClient.initialize <| \http ->
Node.endSimpleProgram
(HttpClient.get "data:text/plain,hello"
|> HttpClient.expectString
|> HttpClient.send http
|> Task.andThen (\_ -> Debug.todo "after the response")
|> Task.onError (\_ -> Stream.writeLineAsBytes "the request failed" env.stdout |> Task.map (\_ -> {}) |> Task.onError (\_ -> Task.succeed {}))
)
It prints nothing. Replacing the three HttpClient lines with Task.succeed {}
prints the TODO.
- Lingua principale
- JavaScript
- Stelle
- 13
- Fork
- 6
- Merge medio
- 2g 4h
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 gren-lang/node
-
breaking enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 38/100
-
breaking enhancement
Difficoltà 3/5 1-2 giorni Idoneità per principianti 42/100
-
breaking bug
Difficoltà 3/5 1-2 giorni Idoneità per principianti 64/100
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
-
enhancement
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
Tutte le issue di gren-lang/node
Issue simili
-
Buddies in the protocol fuzzApertaai-proposed
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
area: certificates help wanted priority: must type: docs
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
WNSolutions/digimenu-tn#35 ·
-
bug priority: low
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
sandialabs/sceptre-phenix#464 ·
I maintainer di solito rispondono entro 6 giorni
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
hemilabs/token-list#124 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 61/100
I maintainer di solito rispondono entro 1 giorno