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-jsalready 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.
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. SinceConnection._connection
is private and thedisconnect
listeners are an implementation detail ofrhea-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 withsetMaxListeners
.Brief description of the changes made in the PR. This helps in making better changelog
MaxListenersExceededWarning
when closing multiple links or sessions.Reference to any github issues