-
Notifications
You must be signed in to change notification settings - Fork 357
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
warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit. #451
Comments
Don't create the exchange each time you publish. |
@postwait thanks for the reply. As you suggested, I modified the code so it does not create the exchange each time. And this resolved the initial memory leak warning from node. I kept track of the listeners on the connection object and, when RMQ is running constantly, the listener count remains the same. However, if the RMQ server is bounced, it looks like the listener count begins to creep upwards, albeit at a slower rate. The code I ran and resulting output is below.
And here's the output. The comments (indicated by -->) in the file I added to help explain what was going on.
I ran the test a lot longer and the listener count kept increasing until I ultimately got the same node.js warning, Am I improperly handling connections/exchanges or is there a lower level bug in the reconnection logic as it pertains to handling event listeners? Thanks. |
having a similar issue. |
I'm also facing the same issue. |
Hello,
I have code which rapidly publishes data to an exchange. After a number of publishes, I'm getting an error indicating a memory leak inside the amqp library,
(node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit.
.I found similar bugs on the issue tracker, but most were old (~2013) and none captured this exact scenario.
Here is example code which reproduces the bug:
The resulting output:
node version:
node-amqp version:
Any help would be much appreciated.
The text was updated successfully, but these errors were encountered: