Skip to content
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

Cypress sometimes stalls/hangs with no output when running in Jenkins with Docker #8206

Closed
kaiyoma opened this issue Aug 6, 2020 · 92 comments
Labels
CI General issues involving running in a CI provider E2E Issue related to end-to-end testing

Comments

@kaiyoma
Copy link

kaiyoma commented Aug 6, 2020

Current behavior:

I feel like this kind of issue has been referenced many times before, but even after trying all the solutions I've found, we still continue to run into this problem. We've been seeing this issue for many months now, with early versions of Cypress 4.x and even with the most recent version today.

Long-running (multi-hour) test suites often "stall": the output stops appearing, but nothing actually fails or crashes. We actually have to rely on the timeout mechanism in Jenkins to kill the task because Cypress is just stuck.

I have enabled debug logs and honestly I don't see anything helpful in them. I'll upload the relevant portion next, but there are no mentions of failures, crashes, or even being out of memory. We're already following all the guidance in the Cypress docs about disabling /dev/shm and using the correct IPC setting.

Desired behavior:

Tests should either run to completion or Cypress should fail with a clear error.

Versions

Cypress: 4.12.1
OS: Linux
Browser: Chrome 83 (headless)

@kaiyoma
Copy link
Author

kaiyoma commented Aug 6, 2020

Here's an abridged version of the full Cypress debug log: cypress-debug-abridged.log

In our Jenkins output, this is the last message I see:

06:43:15        ✓ should render a read & write view for Image Management (3909ms)

You can see this mocha test at the top of the logfile. But after that, no more mocha tests are triggered for some reason. Nothing runs out of memory, nothing crashes, nothing fails, nothing exits. Everything just stops responding and Cypress seems to be waiting for an event that'll never happen.

I can furnish the full debug logfile (13.2 MB) upon request.

@AnkitPhalnikerTR
Copy link

We are facing similar issue, Cypress just hangs indefinitely during UI test runs, no error, no logs. The only option is to close and run the tests again. We are running them locally, have not integrated with CI yet.

@cellog
Copy link

cellog commented Aug 17, 2020

Also seeing this, about 1 every 50 test runs, Cypress will hang, occasionally for 12 hours(!) if no one notices

@jennifer-shehane
Copy link
Member

The debug logs don't indicate anything that we can go off of. We'll need a way to reproduce this in order to investigate.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Aug 18, 2020
@mblasco
Copy link

mblasco commented Aug 18, 2020

I'm also experiencing the same issue. It seems that it's a recent issue. At least I was able to experience it with Cypress 4.11 and also 4.12.X. I even had to write down a script that cancels a test if it's running for more than 30 min and trigger it again. In our particular case we have been running 3 instances of Cypress in parallel in the same machine and it's been working for months. But now, as someone said, from time to time one of the tests hangs indefinitely, with no output indicating if there was a failure or something. I will try to gather some info of what's going on and post it here.
About our environment, we are not running Jenkins nor Docker. It's just a linux machine running tests against an external website.

@kaiyoma
Copy link
Author

kaiyoma commented Aug 18, 2020

The debug logs don't indicate anything that we can go off of. We'll need a way to reproduce this in order to investigate.

Run multi-hour test suites in a Jenkins/Docker environment until you start to see Cypress hanging. 😄

On a serious note, it sounds like several people are seeing this problem, and we all have access to such environments, so maybe you'll have to just leverage that rather than trying to repro yourself. Is there any other logging or debugging instrumentation we should turn on that would be helpful?

@anaisamp
Copy link

I've also experienced this.
I don't have a long-running/multi-hour test suite though, I only have 2 test files so far.
The tests have always passed locally. But when running inside a docker container, tests hanged most of the times, without any feedback, and I had to manually stop the Jenkins pipeline.

After a few days of trying things out, making these 3 changes helped me.

  1. Not using Chrome. Before I was using --browser chrome. When I removed it, I saw a helpful output, at the same stage where the tests used to hang.

Screenshot 2020-08-18 at 19 47 35

  1. I could see the error was related to a memory leak. So I added ipc and shm_size to the docker-compose file, as everyone was advising. (Had done it before, but seemed to have worked only after not using Chrome.)
version: '3.5'
services:
  app-build:
    ipc: host
    shm_size: '2gb'
  1. I'm using fixtures, and I trimmed them to use smaller .json files.

Please note I'm just sharing what seemed to have worked for me, but I don't consider this a solution. It sounds like an issue that should be looked into.

@kaiyoma
Copy link
Author

kaiyoma commented Aug 19, 2020

Interesting. To the best of my knowledge, we've seen the opposite trend: using Electron was worse and switching to Chrome has slightly improved things. But we still run into this hanging problem with both browsers. (This would make sense if the problem is actually with mocha, which is kind of what the logs would suggest.)

@bradyolson
Copy link

FWIW, we were seeing this nearly every test suite execution (>90%) in our CI runner (AWS CodeBuild with parallelization, using Chrome), with no issues running locally. Today we upgraded to v5.0.0 and the hanging/stalling has seemingly stopped

@kaiyoma
Copy link
Author

kaiyoma commented Aug 19, 2020

@bradyolson Good to know! We're attempting to upgrade Cypress this week, so maybe in a few days I can report back with our results.

@cellog
Copy link

cellog commented Aug 20, 2020

I have an update on this:

I noticed that Cypress tests were downloading a few static assets in a continuous stream. The site logo, a font, etc. They would be downloaded hundreds of times in a single test, and in some cases completely overwhelm the browser, causing the test to fail. This happened locally too.

I downgraded to version 4.9.0 from 4.12.0 and the issue went away. I hope this gives some context to help.

For some other context: this happened in end-to-end mode and in mock mode (we run our tests in both modes) AND in a new mode using mock service worker, but NOT when running the app in development or in production through a regular Chrome browser.

@kaiyoma
Copy link
Author

kaiyoma commented Aug 24, 2020

We finally got Cypress 5 to run and hit the same exact problem. No improvement.

@kaiyoma
Copy link
Author

kaiyoma commented Aug 27, 2020

I spent the afternoon trying to run our tests with Firefox (which I realize is in "beta") and noticed that this problem seems a lot worse with Firefox. It's the same symptoms as before: console output stops appearing, mocha events appear to stop coming in, but the debug log keeps chugging along with memory and CPU updates.

When trying to run our usual battery of ~50 test suites, we couldn't get further than 5 suites, sometimes failing at even the first one. With Chrome, we could always get at least 25 or 30 suites in before the stall happens.

@kaiyoma
Copy link
Author

kaiyoma commented Aug 28, 2020

I've tried a new approach/workaround in our project where instead of passing all our test suites to Cypress all at once, I pass the test suites one at a time.

Before:

cypress run --browser chrome --headless --spec foo.spec.js,bar.spec.js,baz.spec.js

After:

cypress run --browser chrome --headless --spec foo.spec.js
cypress run --browser chrome --headless --spec bar.spec.js
cypress run --browser chrome --headless --spec baz.spec.js

This seems to have helped a little bit, though last night we hit an error even with this approach. About 2 hours into the testing, a test suite stalled after running for only a couple minutes and Jenkins had to kill the task a couple hours later.

@kaiyoma
Copy link
Author

kaiyoma commented Sep 3, 2020

We encountered this failure again last night with the same symptoms. Now that we're running our test suites one at a time, the logs are smaller and easier to digest. Still seems like Cypress is at fault here.

In the Jenkins output, we can see that the test suite stalled after executing for only a minute:

03:20:20    (Run Starting)
03:20:20  
03:20:20    ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
03:20:20    │ Cypress:    5.0.0                                                                              │
03:20:20    │ Browser:    Chrome 84 (headless)                                                               │
03:20:20    │ Specs:      1 found (topology/overlay.spec.js)                                                 │
03:20:20    │ Searched:   cypress/integration/topology/overlay.spec.js                                       │
03:20:20    └────────────────────────────────────────────────────────────────────────────────────────────────┘
03:20:20  
03:20:20  
03:20:20  ────────────────────────────────────────────────────────────────────────────────────────────────────
03:20:20                                                                                                      
03:20:20    Running:  topology/overlay.spec.js                                                        (1 of 1)
03:20:20    Adding --disable-dev-shm-usage...
03:20:20    Adding --disable-gpu...
03:20:20    Adding --window-size=1920,1080...
03:20:38  
03:20:38  
03:20:38    Topology overlay tests
03:21:24      ✓ should navigate to Topology application (40059ms)
03:21:24      ✓ should have the right options in the select (352ms)
04:01:08  Cancelling nested steps due to timeout
04:01:08  Sending interrupt signal to process
04:01:20  Terminated

In the full debug logfile, I can see that this is the last event we get from mocha:

2020-09-03T10:21:18.281Z cypress:server:reporter got mocha event 'hook end' with args: [ { id: 'r5', title: '"before each" hook', hookName: 'before each', hookId: 'h2', body: ...

There are no more mocha events and the test never starts execution. This is also verified by the video file that Cypress writes out. I can see in the video that the sidebar never "expands" for the doomed test. Instead of seeing the list of get and assert calls, the spinner next to the test simply spins forever.

I can furnish the Jenkins log, Cypress debug log, and Cypress video upon request (in a DM or some other private channel).

@mayrbenjamin92
Copy link

We have the same issue and we are using Cypress 5.2.0 as it seems to bring in several performance fixes. We are now using Cypress since the 2.X days and I feel that this is getting worse over time.

@bahunov
Copy link

bahunov commented Sep 23, 2020

Any update on this issue?

@kaiyoma
Copy link
Author

kaiyoma commented Sep 24, 2020

Any update on this issue?

+1. Also waiting for updates. We continue to run into this issue often, even with the latest version (5.2.0). I've offered to furnish full logs, but no one's taken me up on it. Kind of feels like the Cypress folks are hoping this issue will just magically disappear.

@danielcaballero
Copy link

We are facing the same issue. Tried to update to 5.2.0 and all kind of workarounds but this is still happening.

@muratkeremozcan
Copy link

muratkeremozcan commented Sep 25, 2020

Similar issues here. There has been a runner change as well as upgrade to Cypress 5.2.0 . We have parallelization as well, and we are using the cypress included docker image.

Firefox tests hang indefinitely. With Electron, we can get the same crashes, but rarely the tests can work.

The trends seems to be tests with ui-login. For the time being we disabled them in CI.

This might help someone.

const ignoreOnEnvironment = (environment: 'linux' | 'darwin' | 'win32', fn) => {
  if (Cypress.platform !== environment) {
    fn();
  }
};

Then, in the test wrap any describe/context/it block

ignoreOnEnvironment('linux', () => {
  describe(....)
});

@dragon788
Copy link

dragon788 commented Oct 19, 2020

If you are running Chrome or Chromium it can be more useful to use --disable-dev-shm-usage as a flag rather than trying to set the --shm-size for Docker or Docker-Compose, especially when running in Docker-in-Docker on Jenkins or other CI providers.

https://developers.google.com/web/tools/puppeteer/troubleshooting#tips

#5336 (comment)

@muratkeremozcan
Copy link

muratkeremozcan commented Oct 20, 2020

If you are running Chrome or Chromium it can be more useful to use --disable-dev-shm-usage as a flag rather than trying to set the --shm-size for Docker or Docker-Compose, especially when running in Docker-in-Docker on Jenkins or other CI providers.

https://developers.google.com/web/tools/puppeteer/troubleshooting#tips

#5336 (comment)

This helped. Thank you!

The info resource can also be found that at Cypress docs. If your tests are hanging in the CI, take a look.

There are plenty of questions about configuring the plugins/index.js file. Here is a complex example, not even using the new --config-file pattern, instead using getConfigurationByFile pattern.

const fs = require('fs-extra')
const path = require('path')
// tasks go here
const percyHealthCheck = require('@percy/cypress/task')
const mailosaurTasks = require('./mailosaur-tasks')
// merge all tasks
const all = Object.assign({},
  percyHealthCheck,
  mailosaurTasks
)

function getConfigurationByFile(file) {
  const pathToConfigFile = path.resolve('cypress/config', `${file}.json`)

  return fs.readJson(pathToConfigFile)
}

module.exports = (on, config) => {
  on("task", all);
  // needed to address issues related to tests hanging in the CI
  on('before:browser:launch', (browser = {}, launchOptions) => {
    if (browser.family === 'chromium' && browser.name !== 'electron') {
      launchOptions.args.push('--disable-dev-shm-usage')
    }
    return launchOptions
  });

  const file = config.env.configFile || 'dev'
  return getConfigurationByFile(file)
}

@AlexanderTunick
Copy link

AlexanderTunick commented Dec 4, 2020

Similar issue here. Already throughout months.
Cypress version "cypress": "5.1.0"

From time to time (several times in a week) the execution just stops on random tests.
Screenshot 2020-12-04 at 11 10 38

No errors, no memory ran out. Just stopped and JENKINS continues its execution for "dead tests".

We checked a Server, Docker, Jenkins, and nothing outstanding there.

Can't reproduce it stably nohow, it happens periodically.

@Garreat
Copy link

Garreat commented Dec 4, 2020

##9350 (comment)

@prashantabellad
Copy link

@bahmutov @jennifer-shehane Can anyone from Cypress team update on this?

@gururajhm
Copy link

Guys me to facing same issue. I have been using cypress for almost 1 yr 4 months never faced this issue, I updated to latest version then it keeps hanging or some time memory issues in local and in Circle CI too. Badly need a fix...

-G

@hermape7
Copy link

I have spotted this also in the CircleCI jobs.
I have disabled the shm-usage for the chrome (launchOptions.args.push("--disable-dev-shm-usage");)
This "tests hanging" is occurring from time to time only (1 from 30 runs).

@amakhrov
Copy link

amakhrov commented Jun 29, 2023

It is affecting us badly lately. It used to be a rare case, but seems to have become worse for the last two months or so.

The debug output (via DEBUG='cypress:*') doesn't show anything suspicious. It's just that at some point the tests stop executing at all.
The browser seems to be running for some time after that (there is a periodic network request issued by the last opened page). After some time it stops, too - and the only output produced is CPU/memory profiler.

Looks like this:

2023-06-29T00:04:26.131Z cypress:server:remote-states getting remote state: { auth: null, origin: '<EDIT>', strategy: 'http', fileServer: null, domainName: '<EDIT>', props: { port: '443', protocol: 'https:', subdomain: '<EDIT>', domain: '<EDIT>', tld: 'io' } } for: <EDIT>
2023-06-29T00:04:27.758Z cypress:server:video capture codec data: { format: 'image2pipe', audio: '', video: 'mjpeg (Baseline)', duration: 'N/A', video_details: [ 'mjpeg (Baseline)', 'yuvj420p(pc', 'bt470bg/unknown/unknown)', '1280x720 [SAR 1:1 DAR 16:9]', '25 fps', '25 tbr', '25 tbn', '25 tbc' ] }
2023-06-29T00:04:28.821Z cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
┌─────────┬───────────────────┬──────────────┬──────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
│ (index) │       group       │ processCount │           pids           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
├─────────┼───────────────────┼──────────────┼──────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
│    0    │     'cypress'     │      1       │          '5842'          │    3.55    │      4.33      │  444.29  │    430.59    │   467.24    │
│    1    │    'Electron'     │      1       │          '7305'          │     2      │      3.22      │  399.79  │    413.27    │    522.8    │
│    2    │ 'electron-shared' │      4       │ '5878, 6061, 5879, 6137' │    5.24    │      2.84      │  266.69  │    248.81    │   276.31    │
│    3    │     'plugin'      │      1       │          '6127'          │     0      │      0.03      │  247.06  │    228.53    │   385.09    │
│    4    │     'ffmpeg'      │      1       │          '7319'          │    3.26    │      2.01      │  139.73  │    117.53    │   140.15    │
│    5    │      'other'      │      2       │       '7495, 7496'       │     0      │       0        │   3.86   │     3.74     │    3.86     │
│    6    │      'TOTAL'      │      10      │           '-'            │   14.05    │     12.24      │ 1501.43  │   1399.71    │   1623.33   │
└─────────┴───────────────────┴──────────────┴──────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘
2023-06-29T00:04:29.796Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 56684 }
2023-06-29T00:04:29.807Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 42114 }
2023-06-29T00:04:29.807Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46274 }
2023-06-29T00:04:29.825Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46292 }
2023-06-29T00:04:29.946Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46320 }
2023-06-29T00:04:29.946Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46306 }
2023-06-29T00:04:29.949Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46330 }
2023-06-29T00:04:30.062Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46352 }
2023-06-29T00:04:30.194Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46254 }
2023-06-29T00:04:30.340Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46278 }
2023-06-29T00:04:30.462Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46258 }
2023-06-29T00:04:30.508Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46342 }
2023-06-29T00:04:31.138Z cypress:server:util:socket_allowed allowed socket closed, removing { localPort: 46356 }
2023-06-29T00:04:39.079Z cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
┌─────────┬───────────────────┬──────────────┬──────────────────────────┬────────────┬────────────────┬──────────┬──────────────┬─────────────┐
│ (index) │       group       │ processCount │           pids           │ cpuPercent │ meanCpuPercent │ memRssMb │ meanMemRssMb │ maxMemRssMb │
├─────────┼───────────────────┼──────────────┼──────────────────────────┼────────────┼────────────────┼──────────┼──────────────┼─────────────┤
│    0    │     'cypress'     │      1       │          '5842'          │    2.18    │      4.18      │  415.82  │    429.54    │   467.24    │
│    1    │    'Electron'     │      1       │          '7305'          │    1.25    │      3.06      │  380.07  │    410.5     │    522.8    │
│    2    │ 'electron-shared' │      4       │ '5878, 6061, 5879, 6137' │    5.71    │      3.05      │  264.29  │    249.92    │   276.31    │
│    3    │     'plugin'      │      1       │          '6127'          │    0.09    │      0.03      │  171.81  │    224.16    │   385.09    │
│    4    │     'ffmpeg'      │      1       │          '7319'          │    1.32    │      1.96      │  139.98  │    119.26    │   140.15    │
│    5    │      'other'      │      2       │       '7579, 7580'       │     0      │       0        │   3.71   │     3.73     │    3.86     │
│    6    │      'TOTAL'      │      10      │           '-'            │   10.54    │     12.12      │ 1375.68  │   1397.99    │   1623.33   │
└─────────┴───────────────────┴──────────────┴──────────────────────────┴────────────┴────────────────┴──────────┴──────────────┴─────────────┘
[6061:0629/000445.710042:ERROR:gl_utils.cc(319)] [.WebGL-0x3a4800345500]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels
2023-06-29T00:04:47.223Z cypress:server:server-base Got CONNECT request from collector-pxz6penin0.px-cloud.net:443
2023-06-29T00:04:47.223Z cypress:https-proxy Writing browserSocket connection headers { url: 'collector-pxz6penin0.px-cloud.net:443', headLength: 0, headers: { host: 'collector-pxz6penin0.px-cloud.net:443', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) 

The last messages above are from that periodic network request (from a PerimeterX sensor). Nothing test-specific is printed after that, just Perimeterx requests interleaved with CPU profiling

Cypress 12.11 with Electron

@martincarstens
Copy link

martincarstens commented Jun 30, 2023

🔔 Reposting this for visibility as it might get have gotten buried under the other comments. We use this script to run our Cypress tests: https://gist.github.com/martincarstens/70dd91176e420c6c9ca3de96cafac71d

It's a simple script that auto detects hangs and prevents runaway jobs. Since implementing it over a year ago, Cypress has been stable for us. We have 157 spec files running in various configurations in GitHub Actions with parallel jobs. We are using the latest version of Cypress.

To be fair, we shouldn't need to be using this script, but it is the only thing that returned sanity to our workflows.

@stuart-clark might be able to provide some updates running Cypress with the script in Circle CI.

@cosmith any updates from your side?

Rooting for the Cypress team to put this one to bed.

@cosmith
Copy link

cosmith commented Jun 30, 2023

Hello, on our side we migrated to Playwright.

I do remember that in the end the "no output" that we were seeing in CircleCI was actually a "very long output" when some tests were failing and retrying several times in a row. So it was not really a bug in Cypress (even though it would have been a lot easier to debug if there was some log stating that the test was restarting).

@martincarstens
Copy link

Hello, on our side we migrated to Playwright.

I do remember that in the end the "no output" that we were seeing in CircleCI was actually a "very long output" when some tests were failing and retrying several times in a row. So it was not really a bug in Cypress (even though it would have been a lot easier to debug if there was some log stating that the test was restarting).

We've also started migrating to Playwright, but it's taking us a bit because of all the effort invested into writing Cypress specs. Thanks for the update.

@FranciscoKnebel
Copy link

FranciscoKnebel commented Jul 3, 2023

This bug is very breaking for my use case, so I'm studying a soft migration to Playwright now as well, at least the non-working tests for now.

We also have a big problem caused by how Cypress handles cross-origin and iframe tests, which unfortunately is not stable enough right now, but some test cases are very dependant on it.

This is a real bummer, since the last couple of months I spent on actually migrating our tests from another platform to Cypress, so finding out some very crucial steps are impossible is really demotivating.

For the others watching the thread, some links I read on this migration:

Migration from Cypress to Playwright - hype or great?

On Migrating from Cypress to Playwright

Migrating from Cypress to Playwright

Rewriting tests from Cypress to Playwright using GPT3 by Gajus Kuizinas

Convert Cypress to Playwright (tool built for this migration)

Hopefully the Cypress team fixes these crucial things eventually, but reading over a year old (in this case, almost three) posts reporting the same problem to something as important as just running tests, in a test framework, and that functionality not working, is a deal-breaker.

@SIGSTACKFAULT
Copy link

SIGSTACKFAULT commented Jul 10, 2023

also affecting me in GitLab CI. Using the cypress/browsers Docker image.

Cypress package version: 12.17.0
Cypress binary version: 12.17.0
Electron version: 21.0.0
Bundled Node version: 16.16.0

@alexszilagyi
Copy link

Any updates on this?

@amakhrov
Copy link

We ended up patching the runner (we currently use cypress-cloud) to implement timeout/retry per spec. Hacky af, but our CI pipelines are much more stable now with this change.

@GarrisonD
Copy link

TLDR: Add cy.wait(1000) or more at the end of the test to wait for all requests to finish.

I have an observation that could assist the Cypress team in fixing a potential bug in Cypress (if confirmed as a bug), or individuals like myself in applying a temporary workaround to address the issue.

I came across this thread when my test suite began encountering issues during execution in the CI environment, sometimes stalling midway and necessitating a restart. While restarting occasionally resolved the problem, it wasn't a consistent solution. Despite my attempts at investigation, I was unable to pinpoint the root cause.

Subsequently, I upgraded Cypress to the latest version and encountered a similar issue with a very straightforward test involving the Sign In form. This test includes visiting localhost, inputting login credentials, submitting the form, and then verifying the redirected URL.

The sign-in.cy.ts file wouldn't complete execution in Cypress. It failed to display the statistics for the passed/failed/skipped tests; the process simply hung. Given the simplicity of the test, it became evident that the problem lay with Cypress itself.

I speculated that the issue might be related to requests spawned by the main view of the application, to which users are redirected after a successful sign-in. As a quick workaround, I appended cy.wait(1000) to the test's end, and to my delight, it resolved the problem 🎉

However, I tried to find a more elegant solution utilizing cy.intercept('/api/**').as('api') followed by cy.wait('@api'). Regrettably, this approach didn't yield the desired outcome.

Consequently, I am currently relying on the slightly inelegant but functional cy.wait(1000) workaround, with the hope that this issue will eventually be addressed within Cypress itself. 💡 It's possible that all pending requests could be automatically canceled at the end of each test...

@bahunov
Copy link

bahunov commented Aug 20, 2023 via email

@stuart-clark
Copy link

@stuart-clark might be able to provide some updates running Cypress with the script in Circle CI.

Hi Martin! 👋 To clarify, we've always used Github Actions, not Circle CI.

We don't run into this issue anymore. So we are stable, some notes on our configuration off the top of my head:

While I still think there are issues here, we get around them by being matrixed in such a way that a runner is only running 3-6 spec files of very few it blocks each. Our largest spec file only has 6 it blocks, and each runner only does about 5-6 tests.

To do this efficiently (💸) on Github Actions one needs to leverage actions/cache (https://github.com/actions/cache) and other strategies so you're not spending a ton of time on setup for a large amount of separate runners.

For anyone facing this, I would really just suggest breaking your tests up as much as possible and using a matrix strategy or a script similar to what @martincarstens wrote.

@Phonesis
Copy link

Thanks @GarrisonD

We discovered this today as part of using the new Test Replay feature with Cypress v13. There was always a 1 min wait in our after hook after an assertion around network responses failed.

It is definitely far from ideal adding a wait in like this. There is clearly a bug here around disposing of network call promises or something perhaps

@bahunov
Copy link

bahunov commented Aug 30, 2023 via email

@GarrisonD
Copy link

@bahunov I have more than one test in a file, so yeah, I use afterEach hook.

The key point here is to wait for running requests, where and how is a minor thing.

@zeldigas
Copy link

Just want to share one more workaround for hang problem. In our case we are running files individually, and hang occured after test completion - for some reason cypress failed to properly exit.

I ended up with implementing parallel watchdog with bash to track this.

Gist: https://gist.github.com/zeldigas/6d2041c51b96b98b4859017f55a9bc34

@jennifer-shehane
Copy link
Member

@Phonesis Please make sure to update to the latest version of the Cypress App. We've been actively addressing hanging issues related to Test Replay.

@jennifer-shehane
Copy link
Member

Hi everyone, stalling and hanging within Cypress could be attributed to many different reasons. We do work through hangs/stalls issues as quickly as we can since we know this is the worst situation that your tests can be stuck in and it is an extra expense for CI. The causes we've found for hanging have been very wide and we do need clear reproducible examples provided in order to investigate.

I suggest opening a new issue describing any current hanging issues and as much info as you can provide for us to investigate, including debug logs. Everyone's issue in this thread could be caused by very different things and unrelated. I'll be closing this issue since it is not encompassing a single cause that we can work towards a resolution on and close. We have fixed several causes of hanging issues over the years that might have addressed many of these as well.

@amakhrov
Copy link

Everyone's issue in this thread could be caused by very different things and unrelated

How would one know the root cause for their specific case?
The symptoms in all cases are the same: the thing just gets stuck with no errors / other indication of smth being wrong.

@madardour
Copy link

madardour commented Sep 25, 2023

I have also this issue.
I have 40 test (feature) files with parallel processing using the plugin cypress-parallel. For long time i have running cypress e2e tests in AzureDevops on version 9.x without issues. Begin this year i have upgraded to v12.4. Upgrade was necessary for me because of the proxy. v9.x (or i ) was not able to call webserver behind a proxy.
Since upgrade to v12 the cypress process hangs. The process still appears in TaskManager but it does nothing and AzureDevops waits for until i kill the proces manually.
i have tried several versions (12.4, 12.10, 12.13, 12.15, 13,0) and the issue still occurs.

@nagash77
Copy link
Contributor

@madardour please open a new issue with a reproducible example and the Cypress team will be happy to investigate.

@jennifer-shehane jennifer-shehane added CI General issues involving running in a CI provider and removed CI: jenkins labels Oct 5, 2023
@elenasch
Copy link

I have been running into a similar issue with Cypress just hanging. In my case it was on a very particular new test suite that was added. What we found is that the app UI had performance issues with excessive DOM element counts.
This perf issue didn't surface to naked eye, but crashed several of our QA automation systems and frameworks (Jest, Selenium and Cypress). The Cypress side effect was a handing runner.

Hope that helps with reproduction and fixing this scenario.

Cypress 12.7.0
It didn't matter how large or small machine resources running these tests were. The runner hung the same way, and I could see the memory of chrome browser growing over time, but other processes didn't get affected as much.

We have ~4500 DOM elements on initial render and that number kept growing (anything over ~1500 is known to be a possible perf bottleneck)

@cypress-io cypress-io locked and limited conversation to collaborators Nov 27, 2023
@jennifer-shehane jennifer-shehane removed the prevent-stale mark an issue so it is ignored by stale[bot] label Nov 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CI General issues involving running in a CI provider E2E Issue related to end-to-end testing
Projects
None yet
Development

No branches or pull requests