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. 11 lookup listeners added to [Socket] #176

Open
pjonsson opened this issue Jan 24, 2025 · 0 comments

Comments

@pjonsson
Copy link
Contributor

My logs TerriaMap 0.2.4 logs contain quite a few warnings about:

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 lookup listeners added to [Socket]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit

and I also get the same warning but for [TLSSocket]. I don't think this is something that was introduced recently, I also got the warnings with TerriaMap 0.2.2.

Here is a warning but with --trace-warnings enabled:

(node:1) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 lookup listeners added to [Socket]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at _addListener (node:events:598:17)
    at Socket.addListener (node:events:616:10)
    at Readable.on (node:internal/streams/readable:1128:35)
    at Socket.once (node:events:660:8)
    at Request.<anonymous> (/app/node_modules/terriajs-server/lib/controllers/proxy.js:266:32)
    at Request.emit (node:events:524:28)
    at ClientRequest.<anonymous> (/app/node_modules/request/request.js:858:10)
    at ClientRequest.emit (node:events:524:28)
    at tickOnSocket (node:_http_client:857:7)
    at onSocketNT (node:_http_client:920:5)
    at process.processTicksAndRejections (node:internal/process/task_queues:91:21)

I had a look in the code and it looks like it's the line with socket.once('lookup', ..) that causes the warning, but from my reading it seems that once() event listeners are removed when triggered, so perhaps this is one of the uncommon cases where it's not a leak and the limit should be increased?

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

No branches or pull requests

1 participant