nodejs / nodejs/node

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

Offen
#47,228 18 Kommentare 3 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

confirmed-bug http https
Vorherrschende Sprache
JavaScript
Sterne
122k
Forks
37.3k
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
283

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne damit, die bereitgestellte https.get-Reproduktion unter Node v19.8.1 auszuführen, und vergleiche sie mit der Variante keepAlive:false und Node 18. Verfolge den Lebenszyklus der https-Anfrage und des Agents, um festzustellen, warum eine erfolgreiche HEAD-Antwort den Prozess am Leben hält. Als erledigt gilt die Aufgabe, wenn das standardmäßige Keep-Alive-Verhalten diesen Prozess nicht mehr hängen lässt und die gemeldete Reproduktion durch Tests abgedeckt ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
javascript, nodejs
Bereich
backend, networking
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
42/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.