vitaly-t / pg-iterator

7 stars 1 forks source link

Possible EventEmitter memory leak #5

Closed bdharrington7 closed 1 year ago

bdharrington7 commented 1 year ago

I was playing with the pg-iterator@0.2.7 library, using the code in https://github.com/vitaly-t/pg-iterator/issues/4#issuecomment-1345136650

node.js: 16.13.1 pg-promise: 10.15.4

I noticed that when this is executed in rapid succession (i.e. clicking quickly), a warning is emitted from node:

(node:162) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:465:17)
    at Client.addListener (node:events:487:10)
    at BoundPool._release (/app/node_modules/pg-pool/index.js:329:12)
    at Client.release (/app/node_modules/pg-pool/index.js:322:12)
    at QueryIterablePool.finish (/app/node_modules/pg-iterator/dist/from-pool.js:80:25)
    at QueryStream.<anonymous> (/app/node_modules/pg-iterator/dist/from-pool.js:36:18)
    at Object.onceWrapper (node:events:509:28)
    at QueryStream.emit (node:events:402:35)
    at QueryStream.emit (node:domain:475:12)
    at endReadableNT (node:internal/streams/readable:1343:12)