loopbackio / loopbackio/loopback-connector-postgresql
PG DataSource Error handler throwing memory leak warning
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 118
- Forks
- 184
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 5
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Use the linked sandbox and its README to reproduce the MaxListenersExceededWarning with a PostgreSQL DataSource and an onError handler. Then inspect the connector's connection-pool release path; done means repeated use no longer accumulates error listeners before a connection is returned to the pool.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs, postgresql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100