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

Set the max listener limit to 1000 for RheaConnection #110

Merged
merged 1 commit into from
May 2, 2024

Conversation

the-ress
Copy link
Contributor

@the-ress the-ress commented Apr 9, 2024

Description

NodeJS would issue warning if the number of disconnected listeners on an event emitter exceeds 10. When many sessions or links on a connection are closed at the same time, we will see this warning because the default limit of 10 in NodeJS is too low. The disconnected listeners DO get removed eventually.

This causes Azure/azure-sdk-for-js#29186 when it stops all its Link objects at the same time.
(Source links: Link.stop call, the loop)

azure-sdk-for-js already raises the limit this for some other objects. Since Connection._connection is private and the disconnect listeners are an implementation detail of rhea-promise, I felt it was more appropriate to address it here.

There's also a draft PR #78 from 2021 trying to address this issue, but it looks a lot like (partially) reimplementing EventEmitter just to remove the listener warning. That's why I ultimately decided to go with setMaxListeners.

Brief description of the changes made in the PR. This helps in making better changelog

  • Fixes MaxListenersExceededWarning when closing multiple links or sessions.

Reference to any github issues

@jeremymeng
Copy link
Collaborator

Thanks for the PR @the-ress!

@jeremymeng jeremymeng merged commit cd5c42c into amqp:master May 2, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants