amqp / rhea

A reactive messaging library based on the AMQP protocol
Apache License 2.0
273 stars 80 forks source link

Raise max listener limit for connections #418

Open deyaaeldeen opened 2 months ago

deyaaeldeen commented 2 months ago

This warning from NodeJS is emitted when there are more than 10 connections in one session and they're being closed:

(node:7050) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnected listeners added to [Connection]. Use emitter.setMaxListeners() to increase limit (Use node --trace-warnings ... to show where the warning was created)

Although this warning is generally helpful in detecting leaks, the user has already made a conscious decision to connect to that many connections and the warning is not helpful to them in this context. They're already trying to close those connections, and, in that process, we need to install listeners for disconnection events.

To disable this warning, this PR raises the limit on max listeners to 1000 for connections.

grs commented 1 month ago

Could this not be done by the application itself?