loopbackio / loopbackio/loopback-connector-postgresql

PG DataSource Error handler throwing memory leak warning

未关闭
#746 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

bug
主要语言
JavaScript
星标
118
派生
184
平均合并
1 天 22 小时
30 天内合并 PR
5

描述

Steps to reproduce

  • Add onError handler in DataSource for Loopback Connector Postgresql.
  • Use DataSource on frequent manner.
  • It should throw warnings like
    (node:80014) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Client]. Use emitter.setMaxListeners() to increase limit

(More details to reproduce the issue are provided in the README.md file in the sandbox repository)

Current Behavior

It doesn't remove the attached error event listeners while releasing the connection back to pool.

Expected Behavior

It should remove attached event listener before releasing connection back to pool.

Link to reproduction sandbox

https://github.com/vinod-hansda/loopback-pg-warning

Additional information

node -e 'console.log(process.platform, process.arch, process.versions.node)' :-
darwin arm64 18.20.6

npm ls --prod --depth 0 | grep loopback :-
npm warn config production Use --omit=dev instead.
loopback-pg@0.0.1 /Users/vinodhansda/Documents/GitHub/loopback-pg-warning
├── @loopback/boot@5.0.10
├── @loopback/core@4.0.10
├── @loopback/repository@5.1.5
├── @loopback/rest-explorer@5.0.10
├── @loopback/rest@12.0.10
├── @loopback/service-proxy@5.0.10
├── loopback-connector-postgresql@7.1.9

Related Issues

See Reporting Issues for more tips on writing good issues

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

使用链接的 sandbox 及其 README,通过 PostgreSQL DataSource 和 onError 处理程序重现 MaxListenersExceededWarning。然后检查 connector 的 connection-pool release path;完成的标准是,重复使用时,在连接返回 pool 之前不再累积 error listener。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, nodejs, postgresql
领域
database
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。