-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
[Spike] Investigate increased memory usage with recent Firefox versions (98+) #21319
Comments
I was able to take a look into this. So it looks like the memory leak is coming from instances of Cypress's reporter.errors.spec.js (~3,386 MB) with primaryOriginCommunicator enabled and all methodsreporter.errors.spec.js (~2,197 MB) with primaryOriginCommunicator commented out/disabledreporter.errors.spec.js (~3,358 MB) with primaryOriginCommunicator enabled and one event present (leak detected)I ran this against regular cypress tests in the driver as a control group to verify my hypothesis driver check.spec.js (~196 MB) with primaryOriginCommunicator disableddriver check.spec.js (~194 MB) with primaryOriginCommunicator enabled and all eventsSince the reporter.errors.cy.ts (~702 MB) with primaryOriginCommunicator enabled and all eventsreporter.errors.cy.ts (~644 MB) with primaryOriginCommunicator disabledSince this does not seem to be a user impacting users, and fixing it is likely going to not applicable in the |
I will be adding a few clean up methods to make sure the communicator events are cleaned up in any case, just to hopefully prevent this issue in the future |
The code for this is done in cypress-io/cypress#21634, but has yet to be released. |
Additionally - open mode is very different than run mode, and the debugging features of snapshots are effectively a controlled memory leak. When doing perf/memory profiling it's better to use run mode where those features are disabled. |
Released in This comment thread has been locked. If you are still experiencing this issue after upgrading to |
Current behavior
When updating our internal CI image to run with Firefox 98, one of our existing builds started timing out/crashing due to a lack of resources. Example
I was able to trace this increase back to a commit and gather some metrics before/after it was merged:
Spec ran: runner/cypress/integration/reporter.errors.spec.js
OS: macOS Monterey
System: i9 / 16GB total RAM
To summarize, with 676fc97 (the origin feature branch merge) we start using a lot more memory with FF99. Chrome 101 stays relatively stable.
That spec file has 83 individual tests in it, and its snapshots can be quite large. So I also recorded runs with the
numTestsKeptInMemory
config value set to 0 to see what impact it had on memory usage. You can see that with 0bb655e, setting that config property had a significant impact on FF99 and cut its usage in half; however, it had a minimal effect on 676fc97. It also had a decreased effect with Chrome 101 on 676fc97, with usage up 12% from the previous commit.We should track down where/why this memory is being held.
Desired behavior
We don't consume more memory than we have to when running with Firefox.
Test code to reproduce
yarn cypress:open
Cypress Version
9.6.0
Other
No response
The text was updated successfully, but these errors were encountered: