sparebytes sparebytes - 8 months ago 59
Node.js Question

Make node show stack trace after EventEmitter warning

I have this error:

(node:11164) Warning: Possible EventEmitter memory leak detected. 11 end listeners added. Use emitter.setMaxListeners() to increase limit

No stack trace is given so I have no idea which event might be the culprit.

I tried to work around it by overriding
but the stack trace at that point is of no use since
is not called when the listener is added but some arbitrary time afterwards.


This changed with Node v6 (or possibly with v5).

Previously, a stack trace was shown automatically, now you have to generate one yourself:

process.on('warning', e => console.warn(e.stack));

Documented here.