chromeless icon indicating copy to clipboard operation
chromeless copied to clipboard

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

Open HenleyKuang opened this issue 7 years ago • 1 comments

I added a Page.domContentEventFired event listener to the goto function and it looks like the event listener is stacking up after each call to goto.

The error I'm seeing is: MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Page.domContentEventFired listeners added. Use emitter.setMaxListeners() to increase limit

Is there any way to clear the event listener?

  • Chromeless Version you're using: Google Chrome 62.0.3202.75
  • Operating System: Linux CentOS7

HenleyKuang avatar Feb 12 '18 20:02 HenleyKuang

Hey @HenleyKuang ,

maybe there is another way to fix it, but you can increase the max listener size. You can find a way in the docs of nodejs.

For me this solution works:

let totalCalls = 20;
process.setMaxListeners(totalCalls);

// Now you can call chromeless.goto 20 times without an error.

MisterMarlu avatar Feb 16 '18 09:02 MisterMarlu