-
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
The Chromium Renderer process just crashed - 'sad face' Error #7204
Comments
hmm it seems that there is some memory leak with Cypress. After running it locally and using Activity Monitor to profile the "Google Chrome Helper (Renderer)" process I can see that it starts at about 400mb memory and slowly climbs up to 4gb as the test runs... 🤔 |
I added the profiling environment variable My output looks like this image below. It seems that with every print the first like, "Electron", is taking more and more memory usage. Everything else seems to be pretty stable. |
I am facing the same issue when trying to run Cypress on local Jenkins. See this Issue-7200 |
hmm... how are you getting the exact memory usage displayed when it crashes? that's pretty cool. haha I am running it on a 1gb digital ocean linux server, but still I wouldn't expect it to just continually increase in memory. @zac11 are you switching pages a lot? I am ,and it seems like every time I switch pages memory goes up like 150mb. I am also creating big objects on each page (but I was hoping they would be freed once the leaving the page). |
The CPU usage is based on a number of things. The Cypress app itself is running, Chromium is running and the application under test is running. If you're doing very memory intensive things within testing the app, then yes, this will require more CPU on the machine to handle. If it's maxing out, we recommend increasing the machine resources. |
Thanks @jennifer-shehane, but I don't think I am doing very memory-intensive things. I am going to a few different pages (and on each pages I would think the memory for the previous pages could be freed, which it seems that it is not). I am building up an object of data, but after every 4 pages I reassign that object to The memory never goes down at all-just continually goes up. 🤔 |
@JimLynchCodes Did you try the same tests in Chrome headless? I disabled the shm usage as per the suggestion from @jennifer-shehane here #7200 and even then Electron would crash and the Chromium renderer error would be thrown. I changed the run command to have |
Also how did you do this. I want to have a comparison between Electron and Chrome to see the difference |
@zac11 hmm I did not disable shm usage... I will try that. Btw does anyone know what "shm" stands for? lol In node you can set arbitrary PATH variables before you execute the script / command. It seems like "cypress:server:util:process_profiler" is some special value for the DEBUG variable that cypress looks for. So if you normally run
|
I have the same issue while running cypress in headless mode in Gitlab CI. We have only 5 tests Version 4.4.1 - works fine We are using docker image provided by cypress: For now we stick to version 4.4.1 as it seems to be stable enough. We are considering firefox as it tend to use less memory but we haven't gave it a shot just yet |
We setup a custom gitlab runner as described here |
Unfortunately we'll have to close this issue if there is not enough information to reproduce the problem. This does not mean that your issue is not happening - it just means that we do not have a path to move forward. There's a lot of things that could contribute to the browser crashing, including issues from the underlying application under test that don't have to do with Cypress. Please comment in this issue with a reproducible example so we can assess that this is an issue specific to Cypress. |
Sorry I haven't commented on this in a while. To be fair I was trying to run this on the 1GB cheapest digital ocean server. 😅 Currently I have it running via travisCI which is free since the code is on a public repo (those boxes seem to be ~7gb, and the tests finish successfully after about 4 minutes). I am doing some relatively intense stuff (like scraping a bunch of text from the page, storing it in a giant object, and running a little backend server on the side which saves the object to a db...) It would be really interesting though to get some kind of memory profile (over time?) that shows how much mem is being consumed by cypress and by each of these other things. 🤔 |
I had a similar issue to what you're describing. Running tests in parallel will mostly mitigate the issue, but a big spec file could still cause the process to crash. I was able to address the memory issue by exposing the garbage collector and running it between tests. See #8525 and #350 (comment) Garbage collection is an expensive operation. Javascript's automatic garbage collector will try to stay out of your way, and only run when there is downtime in the code. The issue with this is that even very basic Cypress tests are quite intensive programs that do not have much downtime. When one test finishes, another test runs and so on until there are no tests remaining. The garbage collector will sometimes step in to free up memory, but not often enough to prevent out of memory crashes. When testing a complex page with lots of requests and events, this issue becomes more noticeable. As Electron/Chrome approaches their max MB threshold (2GB by default), the JS runtime does not seem to get more aggressive with garbage collection. In my case, I saw 1.8GB used, and no decrease -- the next test to kick off would put it over 2GB and the app would crash. |
@JimLynchCodes You can log the memory and CPU usage of Cypress by following these instructions: https://on.cypress.io/troubleshooting#Log-memory-and-CPU-usage This will help determine if Cypress is running out of resources and whether the machine requires more. |
Closing as resolved. Running Cypress does require some resources, so running it on an underpowered machine can cause Chrome to crash, especially when testing pages with lots of requests and DOM interactions. @CoryDanielson We'll have to take a look at the window.gc() suggections. 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. |
This fixed it for me: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/2168#note_190617588 |
a combination of: using image: image: cypress/browsers:node14.16.0-chrome89-ff86 adding module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
// ignore examples/
config.ignoreTestFiles = "**/examples/*.spec.js";
// https://github.com/cypress-io/cypress/issues/349
// add --disable-dev-shm-usage chrome flag
on('before:browser:launch', (browser, launchOptions) => {
if (browser.family === 'chromium') {
console.log('Adding Chrome flag: --disable-dev-shm-usage');
launchOptions.args.push('--disable-dev-shm-usage');
}
return launchOptions;
});
return config;
} and explicitly running as chrome: $ npx cypress run --browser chrome got this working for me |
There's a known issue with Electron in this version of cypress that leads to a memory leak and therefore a test run crash. Look at this GH issue for more: cypress-io/cypress#7204.
I'm trying this because it might have worked for someone on the internets cypress-io/cypress#7204
Hi, I am running m cypress script in headless mode on a remote ubuntu 18.03 machine. The strange thing is that it works fine on my local macbook, but I'm getting an error that the Chromium renderer is crashing when running on the ubuntu server. Here is the output:
Is there any way for me to see why it is crashing? 🤔
The text was updated successfully, but these errors were encountered: