nightwatch: possible EventEmitter memory leak detected. 11 error listeners added
If I write a test with 10 or more steps, I get this warning:
(node) warning: possible EventEmitter memory leak detected. 11 error listeners added. Use emitter.setMaxListeners() to increase limit.
Trace
at ClientManager.addListener (events.js:179:15)
at {NPM_INSTALL_DIR}\node_modules\nightwatch\lib\runner\testcase.js:61:10
at _fulfilled ({NPM_INSTALL_DIR}\node_modules\nightwatch\node_modules\q\q.js:794:54)
at self.promiseDispatch.done ({NPM_INSTALL_DIR}\node_modules\nightwatch\node_modules\q\q.js:823:30)
at Promise.promise.promiseDispatch ({NPM_INSTALL_DIR}\node_modules\nightwatch\node_modules\q\q.js:756:13)
at {NPM_INSTALL_DIR}\node_modules\nightwatch\node_modules\q\q.js:516:49
at flush ({NPM_INSTALL_DIR}\node_modules\nightwatch\node_modules\q\q.js:110:17)
at process._tickCallback (node.js:355:11)
The warning makes sense, but it is annoying. So far, I’ve just had to keep my steps below 10 per test. Any other workarounds/solutions are welcome!
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 24 (4 by maintainers)
@beatfactor This is happening again in 1.0.11
(node:5846) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 complete listeners added. Use emitter.setMaxListeners() to increase limitThis is running in Travis
Hi
Please reopen this issue.
I encountered the same issue with nightwatch 1.0.14
Best regards
Hi everybody, I have also encountered this warning message.
Didn’t helped, but I solved it in this way:
durty, but at least it works
As per @kschingiz Adding
require('events').EventEmitter.defaultMaxListeners = 100;to the top ofnightwatch.conf.jssilenced the error for me too.Hi @beatfactor, could you reopen this?
Working for me just as @mpvosseller said but honestly I don’t like it, can you reopen the issue please @beatfactor
FWIW I identified a particular long running test that was causing this issue. I set the following in the test file to ensure that the usual limit on event listeners was preserved elsewhere: