A crash in the task that continues `HttpClient.send` is lost
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 3/5
- Tempo estimado
- Meio dia
- Facilidade para iniciantes
- 68/100
- Tipo de issue
- Bug
- Clareza
- Claramente especificada
- Status de atividade
- Ativa
- Stack de tecnologia
- javascript, node.js
- Domínio
- backend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- JavaScript
- Estrelas
- 13
- Forks
- 6
- Merge médio
- 2d 4h
- PRs com merge (30d)
- 2
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de gren-lang/node
-
breaking enhancement
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 38/100
-
breaking enhancement
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 42/100
-
breaking bug
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 64/100
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
Todas as issues de gren-lang/node
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
rescript-lang/rescript#8996 ·
Mantenedores costumam responder em até 1 dia
-
Add: Ministerstvoidey.ruAbertacheck:passed logos:add
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 68/100
-
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 88/100
fossasia/visdom-dev#69 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 74/100
-
建议写成 1949-Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 62/100
DeanChensj/jiangshan-map#133 ·
Mantenedores costumam responder em até 1 dia