[BUG] pool.close fails when callback is provided; causing memory leak
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 58/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript, node.js
调研方向
从 pool.close() 的实现开始,检查在 callback 路径运行之前,局部的 connections 值和 freeConnections 是如何处理的。更新相关的池关闭测试,使其验证实际的 connections 已关闭,而不仅仅是 freeConnections 为空,并确认 callback 完成时不会留下处于打开状态的 pool。
由索引模型根据 Issue 内容生成。
描述
In function pool.close(), if a callback is provided, the subsequent loop on "freeConnections" does nothing because that structure was previously zeroed out earlier in the function. The foreach should be performed on the local const "connections" which was a copy of "freeConnections" before being zeroed out.
The tests do not catch this because they validate that "freeConnections" is zero afterwards, which it is. But because of the bug, the actual connections were not closed.
The code block that runs when callback is provided
NOW
async.each(this.freeConnections, (connection, cb) => {
connection.nativeClose((error) => {
this.poolSize--;
cb(error);
});
}, error => callback(error));
SHOULD BE
async.each(connections, (connection, cb) => {
connection.nativeClose((error) => {
this.poolSize--;
cb(error);
});
}, error => callback(error));
- 主要语言
- JavaScript
- 星标
- 159
- 派生
- 92
- 平均合并
- 3 分钟
- 30 天内合并 PR
- 2
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
IBM/node-odbc 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
-
security
难度 3/5 1-2 天 新手友好度 45/100
-
难度 4/5 3-5 天 新手友好度 48/100
-
难度 4/5 3-5 天 新手友好度 35/100
-
难度 4/5 3-5 天 新手友好度 38/100
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
vercel-labs/agent-skills#348 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
NanmiCoder/dsh-agent-teams#289 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
c1overzz/dsh-bili-scroll#124 ·
维护者通常 1 天内回复