https://cypress.io logo
Cypress freezes inside docker containers
# i-need-help
a
Hello! Starting from version included:10.8.0 found cypress freezes inside docker containers. Now I'm working on version included:12.4.1 the problem is relevant. Right now I'm running 8 containers distributing tests with --spec. Hangups happen randomly. From 0 to 6 containers per run. Hangups occur when transitioning to a test, or during a test, or after the end of a test. The hang occurs without any errors in the terminal. I am attaching screenshots of the modules used along with Cypress. How can I turn on the logs and understand in more detail what the problem is? Has anyone encountered a similar problem?
Sometimes I get this error before Cypress hangs. But it doesn't always accompanies hangups.
b
Hey @aloof-airport-25580 , have you submitted an issue for this already? https://bit.ly/cypress_issue
e
This looks like you might be running in chrome with hardware acceleration on. If so something like this in your
/plugins/index.js
might fix it:
Copy code
if (browser.name === 'chrome' ) {                                                                  launchOptions.args.push('--disable-gpu');
}
return launchOptions;
Ugh I hate the formatting in Discord, but you get the idea.
a
Hello. The message was not sent. I found similar ones, but they were either already solved, or their solution did not help me. Start a post on github?
Hello. Thanks a lot! I will try this method
Thank you! It looks like this solved my problem. The tests not only became more stable, but also stopped hanging.
t
Quick tip: use 3 backticks for a code block in Discord, also you can specify a code style i.e. JS after the opening backticks
a
I hastened to close the issue. The frequency of freezes has been reduced. And also a new problem arose. This problem is already known and has no solution. Probably worth posting a question on gitlab
e
Ah thanks!
That appears to be a completely separate issue. Is there anything else you are doing to the browsers in that pipeline before running tests? Do you have a different test orchestrator other than Cypress handling things?
a
These are the only interactions with the browser. Didn't make any more changes.
e
The only thing I can think of is adding a retry for your CI/CD and hopefully second time through that doesn't fail there again.
a
Do you mean it? https://docs.cypress.io/guides/guides/test-retries Retry is enabled in the cypress config. But due to browser connection errors, the entire container stops working. And if cypress hangs in the container, then nothing helps.
e
I meant within your CI/CD, do a retry for that step. Not sure what you're using but this is very easy within github actions so Im sure other providers have something similar.
a
I am using gitlab to connect to a VM and run containers inside it. I don't understand how I can restart from a failed step. Can you post an article on this topic?
e
So for gitlab it looks like it's just added as
retry: 2
within your yml https://forum.gitlab.com/t/retry-a-job-multiple-times/58245
a
Thank you! I'm trying to figure out if I can apply this in my work
b
A bit of a wild stab here, but I'd try removing that --auto-open-devtools-for-tabs (at least for CI) - it sounds like in general your CI machine is low on memory.
a
Hey! I considered yesterday this hypothesis. Left '--disable-gpu' and started the run. Followed the readings with htop. At the peak, the load on the virtual machine was 6.5 GB of 14 GB of RAM, and 75% of the CPU. And all the same, freezes of containers were preserved and 2 containers fell due to a connection timeout to the browser.
b
Ah that's really interesting... one thing I realize I didn't see mentioned yet, but did you try enabling debug logs ex.
DEBUG=*
and see what happens for the hung containers? https://www.deploysentinel.com/blog/debug-failing-cypress-tests-in-ci#output-verbose-debug-logs-from-cypress
a
DEBUG was not used. I'll try to analyze the logs during the freeze. Thanks for the advice!
Caught hangups with DEBUG 2 times. Unfortunately. the first time did not save the full log. Apparently with this you can already go to github and start a new topic.
e
Seems like you are running in parallel, is that right? If so I would bump that down by 1 and run.
a
I use a docker image and then build 8 docker containers based on it. There might be another way, but that's the only way I've come up with.😅 I tried to find best practices for parallelizing tests in docker, but did not find a suitable solution that would separate tests
e
Yeah Im not sure on that one. We are using github actions alongside cypress dashboard to run parallel.
a
It is too expensive for my company to purchase a dashboard. Therefore, we have to come up with legal ways to work with alternative functionality.
e
I thought the free version allowed for setting up parallel runs?
a
The free version has a limited number of reports. Do you have enough of this amount? How do you get reports when the limit ends?
e
Yeah Im not sure on that one, we are on a paid plan and have never gone over our limit.
l
I never had luck getting the free version to do parallel runs. It works now that we're paying 🤷‍♀️ Hard to go back and troubleshoot now.
a
Hi all! I figured out the problem of freezing and browser error. I disable loading all images with intercept
Copy code
if (Cypress.env('disableMedia')) {
         cy.intercept(/\.(jpg|jpeg|png|mp4|gif|webp)+$/gi, []).as('trash_requests_media');
     }
10 Views