EventEmitter memory leak detected

Whenever I start Ember, I get an EventEmitter memory leak. It doesn’t seem to affect anything, but I’m wondering if there’s something I can do to get rid of the error

% ember serve
(node) warning: possible EventEmitter memory leak detected. 11 exit listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
    at process.addListener (events.js:239:17)
    at Object.<anonymous> (/Users/denchen/dev/ops-ui/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-merge-trees/node_modules/can-symlink/node_modules/tmp/lib/tmp.js:449:9)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/denchen/dev/ops-ui/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-merge-trees/node_modules/can-symlink/index.js:1:73)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
   at Object.<anonymous> (/Users/denchen/dev/ops-ui/node_modules/ember-cli-babel/node_modules/broccoli-babel-transpiler/node_modules/broccoli-merge-trees/index.js:9:18) 
Environment: development
Livereload server on http://localhost:49153
Serving on http://localhost:3000/

Build successful - 6821ms.

I’m seeing this issue on OSX with Node 4.4.5 as well as RedHat with Node 0.12. These are the possibly relevant packages (there are a bunch others, but I don’t think they have anything to do with the issue):

"broccoli-asset-rev": "^2.4.2",
"ember-cli": "2.5.0",
"ember-cli-app-version": "^1.0.0",
"ember-cli-babel": "^5.1.6",
"ember-cli-dependency-checker": "^1.2.0",
"ember-cli-release": "0.2.8",
"ember-data": "^2.5.0",
"ember-load-initializers": "^0.5.1",
"ember-resolver": "^2.0.3",
"loader.js": "^4.0.1"

I’m not even sure where to start looking to debug this issue.

add a issue Issues · emberjs/ember.js · GitHub

This issue was discussed here: https://github.com/babel/ember-cli-babel/issues/76#issuecomment-226306507

And subsequently fixed here: https://github.com/ember-cli/ember-cli/pull/5987

According to Stefan Penner, the fix should roll out into the next beta sometime next week.

For latest version NodeJS we need to add below line at very starting of your server file.

require('events').EventEmitter.defaultMaxListeners = Infinity;

For Older version

require('events').EventEmitter.defaultMaxListeners = 0;

1 Like