Process does not exit after https request with keepAlive enabled (now default in Node 19)
未关闭
还没有人认领这个 Issue。
confirmed-bug
http
https
- 主要语言
- JavaScript
- 星标
- 122k
- 派生
- 37.4k
- 平均合并
- 4 天 3 小时
- 30 天内合并 PR
- 272
描述
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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,在 Node v19.8.1 上运行提供的 https.get 重现,并将其与 keepAlive:false 变体和 Node 18 进行比较。跟踪 https 请求和 agent 的生命周期,以确定为什么成功的 HEAD 响应会使进程保持运行。完成的标准是:默认的 keep-alive 行为不再使此进程挂起,并且为报告的重现添加覆盖测试。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, nodejs
- 领域
- backend, networking
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 42/100