bigbluebutton/bbb-webrtc-sfu

MaxListenersExceededWarning. Possible EventEmitter memory leak detected

defnull opened this issue · 2 comments

Some other admin (not me) got the following error:

bbb-webrtc-sfu[2463686]: (node:2463686) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 DisconnectAllClientsSysMsgdd5916b92e8b69db9f8820f1fab7e4700bf6fb8d-1683023698009 listeners added to [BigBlueButtonGW]. Use emitter.setMaxListeners() to increase limit
bbb-webrtc-sfu[2463686]: (node:2463686) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 MCS_DISCONNECTED listeners added to [MCSAPIWrapper]. Use emitter.setMaxListeners() to increase limit

EventEmitter will only allow 10 listeners per event by default, unless told otherwise. The first line is almost certainly triggered by

this.bbbGW.once(C.DISCONNECT_ALL_USERS_2x+this.meetingId, this.disconnectUser);
. I'm not sure if this is a leak (event not properly de-registered in certain scenarios) or if there are actually more than 10 valid instance of Video per meeting at the same time (in which case the limit should be increased?), or if it is something else.

Hello @defnull,

. I'm not sure if this is a leak (event not properly de-registered in certain scenarios) or if there are actually more than 10 valid instance of Video per meeting at the same time (in which case the limit should be increased?), or if it is something else.

  1. It's not a leak - events are properly de-registered last time I reviewed that code.
  2. Yes, there's more than one Video instances per meeting (it's 1 per stream)
  3. I did not increase the limits - intentionally. The warning is benign, there's no hard limit being hit there nor should there be any leak. I left it untouched as a reminder to myself: the way those events handlers are set up is not ideal (design wise), so the logs are a frequent reminder that I have to eventually refactor that stuff.

Checking the node.js source I realize that this is indeed just a warning and the listeners are registered anyway. Thanks for clarifying.