Skip to content

Conversation

@jeremymeng
Copy link
Member

@jeremymeng jeremymeng commented Jan 20, 2022

Issues associated with this PR:
#12161

Describe the problem that is addressed by this PR:
During stress tests we are seeing warnings of

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 disconnected listeners added to [Connection]. Use emitter.setMaxListeners() to increase limit

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.

This PR increases the max listener limiter for receiver to 1000. We have done similar for the sender.

What are the possible designs available to address the problem
Another proposal is in PR amqp/rhea-promise#78. It is however looks too complicated.

If there are more than one possible design, why was the one in this PR chosen?
This PR is simpler, and in line with what we are already doing for senders.

We have done similar for the sender.
@ghost ghost added the Service Bus label Jan 20, 2022
@jeremymeng
Copy link
Member Author

This is my understanding of the alternative change discussed in amqp/rhea-promise#78 (comment).

): Promise<Receiver> {
return this._context.connection.createReceiver(options);
const receiver = await this._context.connection.createReceiver(options);
receiver.setMaxListeners(1000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't the same be applicable to event-hubs?

And if possible, applying this logic at core-amqp might be more beneficial?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point!

Connection lives in rhea-promise. I don't want to bump the limit there as other packages than EH and SB also depend on it. We could extend Connection in core-amqp.

@jeremymeng
Copy link
Member Author

Closing as alternative PR #20088 has been merged.

@jeremymeng jeremymeng closed this Feb 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants