Search code examples
node.jssocket.iosails.jseventemitter

MaxListenersExceededWarning in sails js


I am using sails js but encountered with this error

MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 connection listeners added. Use emitter.setMaxListeners() to increase limit

is it a socket issue or something else ?


Solution

  • By default nodejs is set to allow 10 listeners at any event. If you want to change it you can use

    setMaxListeners(n) //n be the number of listeners
    

    Plus you can use node --trace-warning app.js to exactly get to the point which is generating this exception