-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not display MaxListenersExceededWarning "Warning: Possible EventEmitter memory leak detected." warning message during cypress run #1305
Comments
The event emitter warnings are likely nothing important - these are node event bindings which don't affect running tests in the browser. We've had memory issues in the past but it always been related to the browser - the node process itself never uses up that much memory. This is something we likely need to look at and increase the number of listeners. Regardless - you are definitely getting OOM's so something has to be wrong. The thing is though - Cypress runs literally thousands of projects, many of which have many more specs than that - sometimes hundreds of spec files. Cypress also records millions of test runs on a regular basis. I'm saying that because this issue could not possibly be as simple as adding 8 spec files with no content. If that were the case, the thousands of internal tests we run on Cypress would all crash immediately. There has to be something unique to your system that's causing this. How much memory does your system actually have? You say that your OS is both linux and mac - have you seen this exact crash on two independent systems? Your last screenshot looks different as if it's from a CI provider. |
@brian-mann , I reproduced this issue both at MacOS and at Linux (at separate devices). Screenshot with JavaScript heap out of memory error was from Travis CI log. |
PR is fine since we can look at the code and should be able to repro |
This is pr with JavaScript heap out of memory error: valor-software/ngx-bootstrap#3701 And here pr, where I reproduced, that adding 8th spec (even if previous specs were all empty) started throwing warning about memory leak valor-software/ngx-bootstrap#3742 |
For first PR to run e2e tests locally you have to follow next steps:
For second PR, you have to use next commands:
|
@brian-mann I've create empty angular project, install there cypress, and this issue appeared there too. link to project: https://github.com/YevheniiaMazur/emptyProjSypress
|
This warning does display for me in the Angular empty specs run:
There is no warning in Angular empty specs run for me about |
@YevheniiaMazur @jennifer-shehane I expect to see the node event emitter warning - we can take a look at that and get it fixed. I do not expect to see OOM crashes - so anything that reproduces this is helpful. @YevheniiaMazur you mentioned that you were seeing this in Travis - do you mind setting up the empty specs project there and giving a link to a run where this has happened? We'll try to look at the event emitter problem asap just to see where it's coming from and make sure it's not the root cause - preliminarily I don't think it is. |
@YevheniiaMazur after looking at this more - I think you're really describing two separate issues here. Issue 1. Issue 2. Issue 2 likely has nothing to do with issue 1. With that said - there are several existing issues already open in Cypress that have mentioned similar situations. Not OOM'ing - but Cypress slowing down over a period of time. We're aware of these and are about to land a version of Cypress that changes the way we run specs. Instead of bundling them all together - the default way will be to chunk them by spec file and in between that killing the renderer process (the browser). That will purge primed memory and help prevent OOM. This is landing soon (as in landing in Feb) and there's already an open branch with this work. This is part of a much larger issue here which goes into all the glorious intricate details. If your issue is related to this one then it'll be fixed relatively soon. For now you can manually run your specs in isolation with this comment. This will come close to working the same way as when we make this the default in a newer version. |
Can the Cypress team please update this issue? I am new to Cypress and encountering a similar error on current Cypress, current macOS, 16G machine, with just a dozen or so tests running:
Thank you. |
I've also just run into this issue. It seems to be related to the number of specs for us as well. We have 12 specs in this project currently, they run well and that error is not seen in the console log. I am working on a ticket now which adds 3 more specs to the run, we now consistently see this error on the 10th and 11th spec ran, then the build hangs and times out. |
Having same issue. Start getting error after running 10 spec files. |
Just wanted to add, I only see this in electron browser. Running in chrome does not have this issue. We've switched to chrome for now. |
I'm having the same issue - it shows the error after the 10th spec file finishes. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
We are also seeing this on the 11th test.. |
I am also having the same issue and |
We are also seeing this on the 11th test.. |
We're also seeing the same error on 11th test |
We are also having it after the 10th test
|
We are aware of the warnings being displayed for If you are having a situation where they browser crashes, does not load, or in general effects your testing suite run (besides just printing the error!), please open a new issue detailing how to reproduce the error locally on our machines. This issue will be left open for Cypress to address the EventEmitter memory leak and it's warning message only. |
@dil-bpecor try |
@rnovosad interesting! Is |
@NPC sorry, forgot to mention. |
did not work for me; I still get: and at the end of my run:
|
Same problem, |
@rnovosad still no luck, maybe I have not set it right? cypress/support/index.js
Update - Removed the below form the cypress/support/index.js no change:
|
Same here, despite “setting” max listeners to 20 (I'm not confident that command works), I still get warning on the 11th one, as before. |
For others fighting this issue, if you set cypress back to 4.12.1 do you still get the MaxListenersExceededWarning issue? It clears up for me, but the tests take 3x as long to run, so not really a good option. Update: Switching from Electron to Chrome same issue although shows up on 10 of 33 rather then 11 or 33 npx cypress run --browser chrome --config defaultCommandTimeout=10000 screenshotOnRunFailure=true Running: appHeader\appHeader.spec.js (10 of 33) Testing headless chrome (Most test just fail and I get the MaxListenersExceededWarning error): npx cypress run --headless --browser chrome --config defaultCommandTimeout=10000 screenshotOnRunFailure=true Running: appHeader\appHeader.spec.js (10 of 33) |
Added Ten test files (maxtest.spec1.js - maxtest.spec10.js) with: describe('Emitter Test', () => { Running: aaMaxEmitterTest\maxtest.spec10.js (10 of 45) Cypress 6.5.0 |
We're facing the same issue. I've noticed it's exactly 11 GET requests before it throws the error. And it happens only if these GET requestes are fired before the page loads. But I have no idea what can I do with this information, as changing # of listeners does nothing :) |
I'm getting the same error with Cypress 6.3.0, but I don't think it's caused simply by the number of spec files. I started getting the error when I added some tests to my ninth spec file. Now I can successfully run the login test OR the snapshot tests, but if both are enabled, I get the error. I'd like to try working around this issue. Does anyone have a good explanation for which Cypress commands setup event listeners? I'm guessing it's a lot of them. Update: Further Update:
( |
Cypress 6.5.0 and running the last test on 10th spec file produced aforementioned error. Browser used (chrome) Running: **.test.ts (10 of 10) |
Version |
@jennifer-shehane is this something the Cypress team aware of? |
Still existing in 6.8.0. |
Same behavior here. is there any news of this issue ? Using mocha. |
run into same issue: any update for this ? |
Would this be caused by the number of browser instances being created during the run of the tests? Is there a way to output what the listeners are listening to? With this information it seems like it would be easier to track down the issue. I see the maxlisteners warning for the tests but seeing the warning is no guarantee that the tests will fail. Though it does confuse the debugging of the tests because you see a very real warning being appended to your tests. Running the tests with verbose output in Jenkins helped to target in on memory management issues for each test which is nice https://docs.cypress.io/guides/references/troubleshooting#Print-DEBUG-logs |
The code for this is done in cypress-io/cypress#15723, but has yet to be released. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior:
After creating 8 spec files warning about EventEmitter memory leak appears (even if specs contain empty
describe()
). After ignoring this warning and continue creating more specs, last added specs don't run, and appearsFATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
Desired behavior:
Number of spec files do not affect test run
How to reproduce:
cypress/integration
folder create 8 spec files with any content inside them it could be onlydescribe('', () => {});
Additional Info (images, stack traces, etc)
After adding 8th spec next warning appeared:
Even if there are no tests inside them
After ignoring this warning and creating more specs got this error:
The text was updated successfully, but these errors were encountered: