shimaore/esl

MaxListenersExceededWarning: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Event name: *.

Opened this issue · 2 comments

On 8.1.1, at first run of app, this warning appears:
Seems it is about self.once('socket.*', on_error)
When running in trace mode, this is not shown, maybe because of some delay introduced by output?

MaxListenersExceededWarning: (node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Event name: *.
at FreeSwitchResponse.logPossibleMemoryLeak (/appserver/node_modules/eventemitter2/lib/eventemitter2.js:52:15)
at FreeSwitchResponse.growListenerTree (/appserver/node_modules/eventemitter2/lib/eventemitter2.js:228:35)
at FreeSwitchResponse.EventEmitter._on (/appserver/node_modules/eventemitter2/lib/eventemitter2.js:557:24)
at FreeSwitchResponse.EventEmitter._many (/appserver/node_modules/eventemitter2/lib/eventemitter2.js:295:10)
at FreeSwitchResponse.EventEmitter._once (/appserver/node_modules/eventemitter2/lib/eventemitter2.js:267:10)
at FreeSwitchResponse.EventEmitter.once (/appserver/node_modules/eventemitter2/lib/eventemitter2.js:259:17)
at /appserver/node_modules/esl/lib/response.js:145:14
at Promise.cancellationExecute [as _execute] (/appserver/node_modules/esl/node_modules/bluebird/js/release/debuggability.js:324:9)
at Promise._resolveFromExecutor (/appserver/node_modules/esl/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/appserver/node_modules/esl/node_modules/bluebird/js/release/promise.js:79:10)
at FreeSwitchResponse.module.exports.FreeSwitchResponse.onceAsync (/appserver/node_modules/esl/lib/response.js:106:18)
at /appserver/node_modules/esl/lib/response.js:314:21
at /appserver/node_modules/esl/lib/response.js:161:20
at tryCatcher (/appserver/node_modules/esl/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/appserver/node_modules/esl/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/appserver/node_modules/esl/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromiseCtx (/appserver/node_modules/esl/node_modules/bluebird/js/release/promise.js:606:10)
at Async._drainQueue (/appserver/node_modules/esl/node_modules/bluebird/js/release/async.js:138:12)
at Async._drainQueues (/appserver/node_modules/esl/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues [as _onImmediate] (/appserver/node_modules/esl/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:800:20)
at tryOnImmediate (timers.js:762:5)
at processImmediate [as _immediateCallback] (timers.js:733:5)

If you are using the module in "inbound" event-socket mode (client mode), you need to setMaxListeners to (approximately) the number of concurrent operations you might have at a given time (typically I set it to my expected number of concurrent calls), because the pending operations will consume event listeners:

client.setMaxListeners( 200 );

The default is 11 in Node, but that's an arbitrary value.

Yes, I use module as client connecting to FS servers. Thanks for clarification, will give it a try!