possible EventEmitter memory leak detected with mpromise
See original GitHub issuevar def = Model.find({}).exec()
// if we have more then 11 "then waiters"
def.then(function(){
...
})
if we have more then 11 “then waiters” we have an error in console:
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to in
crease limit.
Trace
at Promise.EventEmitter.addListener (events.js:160:15)
at Promise.on (...\node_modules\mongoose\node_modules\mprom
ise\lib\promise.js:61:31)
at Promise.onReject (...\node_modules\mongoose\node_modules
\mpromise\lib\promise.js:154:15)
at Promise.then (...\node_modules\mongoose\node_modules\mpr
omise\lib\promise.js:216:10)
at Object.<anonymous> (...\app\models\muller-word.js:227:21
)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
Not sure if this is expected, but I often use promises in such a way that there may be a lot of listeners for deferred result.
Issue Analytics
- State:
- Created 9 years ago
- Comments:13
Top Results From Across the Web
possible EventEmitter memory leak detected - node.js
I'd like to point out here that that warning is there for a reason and there's a good chance the right fix is...
Read more >Possible EventEmitter memory leak detected. #63 - GitHub
My project installed promise-socket@6.0.3, when I call 'socket.writeAll' in setInterval, some warnings printed on console.
Read more >Understanding memory leaks in node.js part 2 - alxolr
The following example will show an easy way to add a memory leak in your code, ... MaxListenersExceededWarning: Possible EventEmitter memory leak detected....
Read more >Understanding node.js's possible eventemitter leak error ...
js, you'll frequently see this error message: (node) warning: possible EventEmitter memory leak detected. 11 a listeners added. Use emitter.
Read more >what is this "Possible EventEmitter memory leak detect ed ...
what is this "Possible EventEmitter memory leak detect ed" and what to do about it? Hi guys, im running a .js file in...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
FYI if you have the connection object, you can setMaxListeners() on it…
Just use
mongoose.Promise = global.Promise;
(if you’re using node 4 and mongoose 4.1) and this issue should go away as specified in https://github.com/Automattic/mongoose/issues/1992#issuecomment-134257407