Skip to content

PG DataSource Error handler throwing memory leak warning #746

Open
@vinod-hansda

Description

@vinod-hansda

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.
[email protected] /Users/vinodhansda/Documents/GitHub/loopback-pg-warning
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── @loopback/[email protected]
├── [email protected]

Related Issues

See Reporting Issues for more tips on writing good issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions