cypress: Build hangs on CI (Traivs)

Seeing this error for Cypress 2.0.0 and 2.0.1 on Travis CI. The build has finished successfully, but keeps hanging.

  6 passing (25s)
  (Tests Finished)
  - Tests:           6
  - Passes:          6
  - Failures:        0
  - Pending:         0
  - Duration:        24 seconds
  - Screenshots:     0
  - Video Recorded:  true
  - Cypress Version: 2.0.1
No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
The build has been terminated

Example https://travis-ci.org/cypress-io/cypress-example-recipes/jobs/342663254

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (11 by maintainers)

Most upvoted comments

I experience this issue today on CI (specs below). I tried running with Chrome (also inside Docker container) but experienced the same issue as using electron.

I’m on Cypress 3.0.2 and running on CircleCI.

As a workaround, I wrapped the Cypress runtime in a Node script and that allowed my test process to finish. Sharing the approach here in case it helps anyone else.

(uses the death package for process cleanup)

const ON_DEATH = require('death')
const { spawn } = require('child_process');

const cy = spawn('node', ['./node_modules/.bin/cypress', 'run', '--record'], {
  cwd: __dirname,
  env: process.env
});

let out = ''
const end = () => {
  process.kill(cy.pid);

  // looks for X of Y failed in the test summary, if finds, exits with 1
  // otherwise exits with 0.
  process.exit(/\d+\s+of\s+\d+\s+failed/.test(out) ? 1 : 0)
}

cy.stdout.on('data', (data) => {
  const str = data.toString();
  out = out + str;

  // a simple test to listen for the end of the run
  // wait 20secs to exit on its own
  if (/Run Finished/i.test(str)) {
    setTimeout(end, 20 * 1000);
  }
  console.log(str)
});

cy.stderr.on('data', (data) => {
  console.error(data.toString());
});

cy.on('close', (code) => {
  process.exit(code);
});

ON_DEATH(() => {
  process.kill(cy.pid);
});

Then, in my bash script, I call node ./run_cypress.js rather than calling node ./node_modules/.bin/cypress run directly.

Thanks for the debugging/fixes from the Cypress team. Look forward to getting this one solved!

Yup everyone is having the same issue. We’ve added more debug logs in 3.0.3 and came up with a workaround that’ll likely release after.

It honestly makes no sense because it appears to be hanging on synchronous code randomly. With additional debug logs we should have a clearer picture but regardless we’ll figure it out.

To workaround this today

Just switch to using Chrome + our Docker containers (or install them yourself). I believe Chrome is already installed by default in Travis. That will “just work” as this is an Electron only problem.

@brian-mann It doesn’t seem to be related to me setting the videoRecording option. However, I upgraded to cypress 2.0.2 and ran a few times and have pasted the debug log below if it helps.

For a successful quit.

Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers clearing timer id 375 from queue { '375': { args: [], ms: 85000, cb: [Function] } }
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers queuing timer id 376 after 85000 ms
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:project onMocha end
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers child received timer id 376

  6 passing (29s)


  (Tests Finished)

  - Tests:           6
  - Passes:          6
  - Failures:        0
  - Pending:         0
  - Duration:        28 seconds
  - Screenshots:     0
  - Video Recorded:  true
  - Cypress Version: 2.0.2
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:headless attempting to close the browser
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:browsers killing browser process
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:proxy received response for { url: 'http://localhost:38888/arc/sqlrun/jsonselect_parallel', headers: { vary: 'Cookie', 'content-type': 'text/plain', 'transfer-encoding': 'chunked', connection: 'close', date: 'Mon, 19 Feb 2018 06:58:59 GMT', server: 'localhost' }, statusCode: 200 }
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:browsers:electron closed event fired
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:browsers browser process killed
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:headless ending the video recording: /home/jenkins/test/workspace/ui_tests/cypress/cypress/videos/zvw51.mp4
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers queuing timer id 377 after 30000 ms
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers child received timer id 377
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers clearing timer id 377 from queue { '376': { args: [], ms: 85000, cb: [Function] }, '377': { args: [], ms: 30000, cb: [Function: bound cleanupWebsocketResources] } }
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers clearing timer id 376 from queue { '376': { args: [], ms: 85000, cb: [Function] } }
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:timers clearing timer id 376 from queue {}
Mon, 19 Feb 2018 06:58:59 GMT cypress:server:video ffmpeg ended


  (Video)

  - Started processing:   Compressing to 32 CRF
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 22
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 23
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 24
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 25
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 26
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 27
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 28
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 29
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 30
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 31
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 32
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 33
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 34
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 39
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 40
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:timers child sending timer id 41
  - Finished processing:  /home/jenkins/test/workspace/ui_tests/cypress/cypress/videos/zvw51.mp4 (2 seconds)
Mon, 19 Feb 2018 06:59:01 GMT cypress:server:headless Should copy Circle Artifacts? false


  (All Done)

Mon, 19 Feb 2018 06:59:01 GMT cypress:server about to exit with code 0
2018-02-19T06:59:01.704Z cypress:cli Stopping XVFB

and a ‘hung’ run - was hung for 15 mins printing the logs from timers component till a SIGINT was sent from jenkins.

Mon, 19 Feb 2018 07:03:16 GMT cypress:server:timers queuing timer id 404 after 85000 ms
Mon, 19 Feb 2018 07:03:16 GMT cypress:server:project onMocha end
Mon, 19 Feb 2018 07:03:16 GMT cypress:server:timers child received timer id 404

  6 passing (29s)


  (Tests Finished)

  - Tests:           6
  - Passes:          6
  - Failures:        0
  - Pending:         0
  - Duration:        29 seconds
  - Screenshots:     0
  - Video Recorded:  true
  - Cypress Version: 2.0.2
Mon, 19 Feb 2018 07:03:16 GMT cypress:server:headless attempting to close the browser
Mon, 19 Feb 2018 07:03:16 GMT cypress:server:browsers killing browser process
Mon, 19 Feb 2018 07:03:16 GMT cypress:server:proxy received response for { url: 'http://localhost:38888/arc/sqlrun/jsonselect_parallel', headers: { vary: 'Cookie', 'content-type': 'text/plain', 'transfer-encoding': 'chunked', connection: 'close', date: 'Mon, 19 Feb 2018 07:03:16 GMT', server: 'localhost' }, statusCode: 200 }
Mon, 19 Feb 2018 07:03:16 GMT cypress:server:proxy received response for { url: 'http://localhost:38888/arc/reports/savedashboard', headers: { vary: 'Cookie', 'content-type': 'application/json', 'transfer-encoding': 'chunked', connection: 'close', date: 'Mon, 19 Feb 2018 07:03:16 GMT', server: 'localhost' }, statusCode: 200 }
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 22
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 23
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 24
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 25
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 26
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 27
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 28
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 29
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 30
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 31
Mon, 19 Feb 2018 07:03:17 GMT cypress:server:timers child sending timer id 32

@sjones6 You may find our Module API helpful for doing what you’re doing. https://on.cypress.io/module-api

We have spent a considerable amount of time tracking this down and looking into it. The problem is that it fails randomly (and not in every CI provider). Because of that, it’s extremely difficult to understand the root cause.

It’s a high up item on our list and we’ll get it fixed soon. We prioritize problems in CI.

@brian-mann Seeing this error on jenkins 2.105 also. #1235 It looked like my error might be due to #674 but after seeing this issue- this is exactly what I see on jenkins also- everything completes fine but after that it just prints the cypress:server:timers sending, clearing and receiving messages on and on.