Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MaxListenersExceededWarning: Possible EventEmitter memory leak detected #79

Open
dmiwell opened this issue May 26, 2023 · 3 comments
Open
Assignees

Comments

@dmiwell
Copy link

dmiwell commented May 26, 2023

This happens during jest tests run after upgrading to slonik=33.3.1 and roarr=7.15.0. There is memory leaking issue in the case.

Stack given:

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 error listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:587:17)
    at Socket.addListener (node:events:605:10)
    at Socket.Readable.on (node:internal/streams/readable:887:35)
    at createNodeWriter (/node_modules/roarr/src/factories/createNodeWriter.ts:16:10)
    at createRoarrInitialGlobalState (/node_modules/roarr/src/factories/createRoarrInitialGlobalState.ts:43:32)
    at Object.<anonymous> (/node_modules/roarr/src/Roarr.ts:30:44)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/Logger.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/utilities/parseDsn.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/utilities/index.ts:9:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/connectionMethods/any.ts:2:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/connectionMethods/index.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/binders/bindPool.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/binders/index.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/factories/createConnection.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/factories/index.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik/src/index.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik-sql-tag-raw/src/utilities/interpolateNamedParameterReferences.ts:4:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik-sql-tag-raw/src/utilities/index.ts:1:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)
    at Object.<anonymous> (/node_modules/slonik-sql-tag-raw/src/sqlTags/raw.ts:8:1)
    at Runtime._execModule (/node_modules/jest-runtime/build/index.js:1429:24)
    at Runtime._loadModule (/node_modules/jest-runtime/build/index.js:1013:12)
    at Runtime.requireModule (/node_modules/jest-runtime/build/index.js:873:12)
    at Runtime.requireModuleOrMock (/node_modules/jest-runtime/build/index.js:1039:21)

@schongabor
Copy link

+1

@gajus
Copy link
Owner

gajus commented Sep 27, 2023

I was able to replicate the issue. Investigating.

@gajus
Copy link
Owner

gajus commented Sep 27, 2023

Opened an issue with Jest. I am not sure what is causing the memory leak warning or how to mitigate it.

jestjs/jest#14580

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants