sparebytes sparebytes - 1 year ago 109
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.

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download