-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[core-amqp] set the max listener limit to 1000 for sender and receiver #20088
Conversation
NodeJS would issue warning if the number of disconnected listeners on an event emitter exceeds 10. When many sessions on a connection are closed but the removal of the listener hasn't caught up, we will see this warning because the default limit of 10 in NodeJS is too low. The disconnected listeners DO get removed eventually in our code. We already do this for senders created in Service Bus. This PR increase the limit to 1000 for senders and receivers created off `ConnectionContextBase.connection` so that the limites apply to both Service Bus and Event Hubs.
test failure due to known sanitizer issue. |
*/ | ||
async createSender(options?: CreateSenderOptions): Promise<Sender> { | ||
const sender = await super.createSender(options); | ||
sender.setMaxListeners(1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this 1000
be put in a variable instead so it is easier to update it everywhere if there is a need to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extracted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this change makes sense.
Should we also update Service Bus to remove the setting of this limit in this PR now that this comes from core-amqp? |
Yes! I was going to do that once you all are fine with this approach. |
NodeJS would issue warning if the number of disconnected listeners on an event
emitter exceeds 10. When many sessions on a connection are closed but the
removal of the listener hasn't caught up, we will see this warning because the
default limit of 10 in NodeJS is too low. The disconnected listeners DO get
removed eventually in our code.
We already do this for senders created in Service Bus. This PR increase the
limit to 1000 for senders and receivers created off
ConnectionContextBase.connection
so that the limites apply to both Service Busand Event Hubs.
Packages impacted by this PR
core-amqp, service-bus, event-hub
Issues associated with this PR
#12161
Describe the problem that is addressed by this PR
What are the possible designs available to address the problem? If there are more than one possible design, why was the one in this PR chosen?
MaxListenersExceededWarning
- "disconnected listeners" withdisconnectEventAudienceMap
amqp/rhea-promise#78 complicatedAre there test cases added in this PR? (If not, why?)
no functionality changes. covered by stress tests