chromeless
chromeless copied to clipboard
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 Page.domContentEventFired listeners added. Use emitter.setMaxListeners() to increase limit
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
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.