-
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
Memory leak in long running single test - crash #4164
Comments
see #1906 (comment) |
I actually believe this issue will be fixed by this PR which will be merged in the next patch release: #4406 |
It was an oversight / bug that we were still taking snapshots when a single test even though |
Closing this issue as duplicate because I'm very confident this is describing the same behavior as #4104 |
Released in |
@brian-mann / @jennifer-shehane: Retested it with version 3.6.0... still the same issue! :( |
@brian-mann / @jennifer-shehane: can this issue be reopened? |
This issue will be closed to further comment as the exact issue here was resolved and tested. If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix. |
I ran the provided code and was unable to reproduce the crashing described in the original issue. The spec ran for 15 minutes and finished to completion in Cypress 3.8.3 in Electron 78. *Couldn't fit log in one screenshot There will be a new PR in 4.0 that will log process usage that would be helpful to see what is going on here memory wise #6171. How did you assess this is consuming more memory over time? |
@jennifer-shehane could u recreate the issue? any new findings? |
@jennifer-shehane if you want another easily reproductible example it runs a single test which is pretty fast at the beginning and starts to be really slow after ~50 seconds of execution I tried to use if you want to try it out, please install git clone https://github.com/Oliboy50/coinche.git
cd coinche
cd client
npm install
cd ..
cd server
npm install
cd ..
cd e2e
npm install
npm run dev Cypress GUI will pop up and you'll be able to run the test I'm talking about hope it will help (I'd love to have a faster test, one which does not make my computer burn ❤️) |
We're investigating some performance issues related to the rendering of the Command Log such as #6783 where I think the solution to that may also solve this issue. Will have to investigate once there is a proposed PR there. |
Our team has worked around this issue by simply using:
inside of our Note that we are on an older version of Cypress and older image, and we are running this on Gitlab CI: Hopefully this can help someone else 👍 |
Any update on this? this is a huge road blocker in our project. We've long running tests that inevitably end up with the browser crashing bc of out of memory errors. Is there any actual activity/research currently done on this issue? |
Check #25557 I'v also added env var CYPRESS_NO_COMMAND_LOG=1 on our pipeline. I've added some memory graphs on twitter: https://twitter.com/op_kris/status/1636675020180058112?s=46&t=DPClh6K4rCQElpP_CUCryg showing the difference between the usage of the command log or not. |
any updates ?? Error code: Out of Memory |
@CloneOfAlex In order to give our engineers the best chance at recreating your problem, please create a reproducible example using a fork of Cypress Test Tiny. This gives us the best chance of seeing exactly what you are seeing and being able to investigate effectively. |
Could you please inform me if you haven't managed to reproduce this issue from 2019 so I can make reproducible example for you? |
I have seen out or memory errors this recently |
Sadly I cant share our code BUT -- on 16GB laptop when running with local runner , Cypress 13.3.3 / Node.js 20.10.0 - often runner crashes with out of memory error .. // hence forced to run only few scenarios at a time .. Thanks! |
Hi @nagash77 , I have created reproducible example of this issue: https://github.com/StefanTegeltija/memory-leak-in-long-running-single-test, sorry I haven't used for of Cypres Test Tiny but it should not be hard to run my example. |
Any updates for memory problem? |
What Node.js version you have installed ?? do node -v and let us know Also -- you are using OLD Cypress version .. : ( Why dont you install: Node.js 20.11.0 & Lates version of Cypress 13.7.0 |
v16.18.1 |
You are using obsolete Node and Cypress versions .. Install following and try again: |
after installing latest Node and Cypress also run
next mitigate outdated packages run
|
So you managed to fix this issue by these suggestions using my repo? |
BTW the newest version of cypress cannot be downloaded for some reason. npm WARN deprecated @babel/plugin-proposal-class-properties@7.18.6: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
|
OK - try other versions, example 13.3.3 |
Man I tried all versions, and problem is still here, download my repo, try by yourself and I'm sure you will reproduce the issue immediately. |
run this and report back npx cypress --version |
not willing to spend time debugging your repo also even if i reproduce, what do you expect me to do? fix code utilizing old technology? that would be silly application of time Your number 1 priority should be upgrading all of your dependencies to the latest, and next keeping your dependencies stack at latest stable versions at all times .. why? because it makes sense - Chrome, Edge, FireFox browsers keep upgrading and so is Cypress etc |
NO it would be proof that even with latest Node and latest Cypress version problem still exists. |
sure hence invest your own time into upgrading your own repo and testing it there .. etc |
Problem is on Cypress side not on my side. So Cypress QAs has to test it, not myself (I did enough by creating reproducible example). If you aren't member of Cypress company ofc you shouldn't spend time on it, but they should. |
run this and please report back
|
I finally found some time to update this repo: https://github.com/StefanTegeltija/memory-leak-in-long-running-single-test Even I updated everything on the latest version, the issue still exist. Please download repo and try it by yourself. My Chrome version is: 123.0.6312.107 Steps:
stefantegeltija@MTO-1416 memory-leak-in-long-running-single-test % npx cypress --version |
I still have the same issue with npx cypress run & open I tested using differents method :
Or adding :
Or this method : - launchOptions.args.push('--js-flags=--expose-gc');
afterEach(() => {
cy.window().then(win => {
// window.gc is enabled with --js-flags=--expose-gc chrome flag
if (typeof win.gc === 'function') {
// run gc multiple times in an attempt to force a major GC between tests
win.gc();
win.gc();
win.gc();
win.gc();
win.gc();
}
});
}); I downgraded cypress version but nothing seems to be work. It's rather frustrating that it crashes so quickly and so often. Any updates for memory problem?
|
@John4516 and to anyone else still looking for a solution. My solution to this issue ultimately was the use of NO_COMMAND_LOG . In your cypress run command, you can add --env NO_COMMAND_LOG=1. Works like a charm for me. To use this with debugging, try using cypress-terminal-reporter or something similar or add custom loggers. I am using custom loggers as I didn't want to overpopulate my command line or terminal. You can also add, Cypress's garbage collection mechanisms as added benefit but I doubt you will need it. I anticipate your main leak comes from the command log itself which keeps building up in the browser, headed or headless. I doubt video recording will cause this but you can play around. Good luck! |
Current behavior:
Currently if a test runs the same actions repetitively over a long period of time, the memory of the cypress process increases until it crashes. (headless mode, video off, numTestsKeptInMemory 0)
The sample to reproduce runs 15 minutes increasing the memory ~300MB. (the longer the run the more memory is used..)
Desired behavior:
Performance tests should be possible with cypress, without increasing memory and crashing.
Steps to reproduce: (app code and test code)
Config cypress.json
Cypress test
Simple static html site
Versions
Cypress 3.2.0 / 3.5.0 / 3.6.0
Windows 10
The text was updated successfully, but these errors were encountered: