cypress: Cypress hangs during execution of test suite

Current behavior:

During a test run Cypress hangs and never exit, it doesn’t print anything in the stdout while it’s blocked.

From the DEBUG log can be seen that it goes in a kind of loop and prints cypress:server:util:process_profiler current & mean memory and CPU usage by process group every 10 seconds until is terminated by the CI timeout

Desired behavior:

Cypress doesn’t hang and instead fails if something goes wrong.

Test code to reproduce

It’s not happening 100% of the times so I don’t know what’s the root cause, however I’ve attached a debug log

Versions

Cypress 4.0.2 - Chrome 78/Firefox 70.0.1 - Unix executionLogRedacted.txt

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 6
  • Comments: 38 (3 by maintainers)

Commits related to this issue

Most upvoted comments

Same issue has described by OP. I’m running a 75 specs test suite on 20 parallel machines.

Github Actions
Docker image cypress/browsers:node16.13.2-chrome100-ff98
cypress 9.5.4
cypress-cucumber-preprocessor 9.0.5

While i’m writing this, 5 runs out the 7 last runs are hanging in Cypress dashboard. This is costing quite a lot of CI money, even with a timeout set in Github Actions. I tried this without success:

  • remove before and after hooks
  • switch to Docker and use shm_size: 2gb
  • add more machines so there’s less specs running on each machine
  • disable video "video": false
  • "numTestsKeptInMemory": 0
  • switch to Electron instead of Chrome

This is random, I wish I could give you more info to address this issue. Is there any other way we could help? This has been a problem for a lot of people for 2 years now.

Please I have this problem of running it locally … it hangs from time to time on headless mode with chrome … any ideas ?

Yes our tests on Cypress also hang on Github Actions

I confirm I encountered the same issue and shm_size did the trick. But my question is: why does cypress require 2gb of shared memory?

@0xIslamTaha It works, a so big thank you !

–shm-size 2gb

Trying this ! Thx

we faced the same nasty bug and we managed to solve it by adding shm_size: 2GB to the cypress service inside the docker composer but If u are using docker run ... instead of docker-composer then u can do something like docker run --shm_size=2GB .....

Is it possible to set the shm_size when running cypress using the cli cypress open?

@premkumar-gg cypress open should be ahead mode process which gonna use the system memory

Setting shm_size did not work for me, and maybe someone here is wiser than me on why this is happening.

In my pipeline, Cypress hangs for ~2 minutes while executing the last test (I’m not sure whether being the last is meaningful): https://github.com/photion/web-admin/runs/1200705923?check_suite_focus=true#step:7:287

Nothing special happens in the test. I have downloaded a video of the problem and Cypress literally hangs for 2 minutes, and then it executes the test (which actually takes ~1 second).

add options: --shm-size 2gb and for more info check here

I’m also seeing cypress hanging, how does one obtain the Debug logs? Is it possible to print them to a file, since I cannot log in to my CI instance?

The Chrome requests to weird domains is normal behavior, see here: #3151