nodejs / nodejs/node

Process does not exit after https request with keepAlive enabled (now default in Node 19)

Aperta
#47,228 18 commenti 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

confirmed-bug http https
Lingua principale
JavaScript
Stelle
122k
Fork
37.3k
Merge medio
4g 2h
PR unite (30g)
283

Descrizione

Version

v19.8.1

Platform

Linux Jake-Framework 6.2.7-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 18 Mar 2023 01:06:36 +0000 x86_64 GNU/Linux

Subsystem

https

What steps will reproduce the bug?

Run a script containing:

const https = require("https");
const url = "https://github.com/dprint/dprint/releases/download/0.35.3/dprint-x86_64-unknown-linux-gnu.zip";
https.get(url, { method: "HEAD" }, console.log);

This will hang.

How often does it reproduce? Is there a required condition?

100% of the time; downgrade to Node 18 and it no longer hangs.

What is the expected behavior? Why is that the expected behavior?

No hang. Run this:

const https = require("https");
const url = "https://github.com/dprint/dprint/releases/download/0.35.3/dprint-x86_64-unknown-linux-gnu.zip";
https.get(url, { method: "HEAD", agent: new https.Agent({ keepAlive: false }) }, console.log);

And it will succeed.

What do you see instead?

Hang; the request succeeds and the response is given, but the process never exits.

Additional information

This is a change I saw in the Node 19 release blog post; keep-alive is enabled by default now, but, it seems to cause a hang.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia eseguendo la riproduzione fornita di https.get su Node v19.8.1 e confrontala con la variante keepAlive:false e con Node 18. Traccia il ciclo di vita della richiesta https e dell'agent per determinare perché una risposta HEAD riuscita mantiene in vita il processo. Il lavoro è completo quando il comportamento keep-alive predefinito non lascia più questo processo bloccato e la riproduzione segnalata è coperta dai test.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, nodejs
Ambito
backend, networking
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.