cypress: Missing browserCriClient in connectToNewSpec

Current behavior

Unfortunately, this issue is intermittent and only happens in our CI pipeline. But i wanted to see if could raise the issue in case there’s something obvious.

We run cypress with the following: cypress-run cross-env NODE_OPTIONS=--max-http-header-size=1000000 cypress run --browser chrome. And we run in a docker container, using the cypress/included images.

This error happens mid-way running through our test suites. Our tests can take 30 minutes, and the following error seems to occur when ending a test suite (or conversely, when starting the next test suite).

Timed out waiting for the browser to connect. Retrying...
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (<embedded>:2744:242702)
    at Object.connectToNewSpec (<embedded>:2750:24813)
    at process.processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async v.relaunchBrowser (<embedded>:2802:346537)

When this happens, the test run completely exits and the remaining suites do not run.

Desired behavior

For the test run not to crash

Test code to reproduce

Really difficult to do, sorry. It’s intermittent, and it’s a fairly large, sensitive, code-base.

Cypress Version

11.0.1

Node version

16.16.0

Operating System

Jenkins CI - CentOS (but runs the cypress docker image)

Debug Logs

No response

Other

We’ve seen this happening in v10 and v11.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 38 (10 by maintainers)

Most upvoted comments

Unfortunately we are still seeing this issue in 12.7.0

It’s happening just not reproducible. happens for about 2% of builds

Hi everyone, thought I’d give an update on something we’ve changed which has so far stopped this issue from occurring. We’ve increased the mem_limit and mem_reservation in our docker image.

Previously it was set to:

mem_limit: 3500m
mem_reservation: 3250m

and now we’ve updated it to be:

mem_limit: 6000m
mem_reservation: 4000m

Like I said, since this change we haven’t seen the browserCriClient issue once in our CI pipeline (we’d never encountered this locally).

Our original memory must have been set a while ago, and we haven’t thought to change it until now. We thought it might need bumping up after spotting this in the “Hardware” section of getting started, the part about running tests reliably. (https://docs.cypress.io/guides/getting-started/installing-cypress#Hardware)

Hopefully others experiencing this issue can give this a try and share if it works for them too. Good luck everyone.

I am also seeing this error with Cypress 10.11 when running on Jenkins pipeline. This happens very rarely.

3:11:26 Timed out waiting for the browser to connect. Retrying... 13:11:26 Missing browserCriClient in connectToNewSpec 13:11:26 Error: Missing browserCriClient in connectToNewSpec 13:11:26 at Object.connectToNewSpec (/root/.cache/Cypress/10.11.0/Cypress/resources/app/packages/server/lib/browsers/chrome.js:451:19) 13:11:26 at Object.connectToNewSpec (/root/.cache/Cypress/10.11.0/Cypress/resources/app/packages/server/lib/browsers/index.js:96:31) 13:11:26 at processTicksAndRejections (node:internal/process/task_queues:96:5) 13:11:26 at OpenProject.relaunchBrowser (/root/.cache/Cypress/10.11.0/Cypress/resources/app/packages/server/lib/open_project.js:150:24)

Hi @jazpearson , I’m sorry to hear you are having problems using Cypress. Unfortunately without a reproducible example, we wont be able to further assist you. If you can figure out a way to reproduce this issue that you can share with us please do comment here and we can reopen the issue.

Is there anything we can add to help debug this? I know we want a reproducible repo, but it seems most of us aren’t in a position to share our code.

This is starting to cripple us, as we’ve added more tests, the chances of this happening has gone up, and we are having to run tests multiple times to check for passes. Our tests take over an hour to run now.

Seeing this issue in 12.9.0

@chrisbreiding hello, i still got the error only on gitlab (of course) after updating Cypress to 12.7.0, and i’ve no idea on how to reproduce it because, it works sometime, and some other time it fail. I think it’s linked to GitLab parallelization but it’s just an idea.

Hello, i’ve got the same error for no reason today : My devDependencies from package.json looks like that :

"devDependencies": {
    "@badeball/cypress-cucumber-preprocessor": "^15.1.3",
    "@bahmutov/cypress-esbuild-preprocessor": "^2.1.5",
    "@shelex/cypress-allure-plugin": "^2.35.2",
    "@typescript-eslint/eslint-plugin": "^5.51.0",
    "@typescript-eslint/parser": "^5.51.0",
    "allure-js-commons": "^2.0.0-beta.26",
    "cypress": "^12.5.1",
    "cypress-multi-reporters": "^1.6.2",
    "cypress-real-events": "^1.7.6",
    "cypress-recurse": "^1.27.0",
    "cypress-slack-reporter": "^1.5.2",
    "cypress-slow-down": "^1.2.1",
    "cypress-time-marks": "^1.4.0",
    "esbuild": "^0.16.17",
    "eslint": "^8.34.0",
    "eslint-plugin-cypress": "^2.12.1",
    "fs-extra": "^11.1.0",
    "mocha": "^10.2.0",
    "mochawesome": "^7.1.3",
    "mochawesome-merge": "^4.2.2",
    "mochawesome-report-generator": "^6.2.0",
    "moment": "^2.29.4",
    "typescript": "^4.9.5"
  },

Any news about that ? I use this new config into my cypress.config.ts file : experimentalMemoryManagement: true,

Awesome! any idea on how much time will take to deploy a fix? Is there any safe version to rollback to?

Hello, I am also seeing this error. I am running my tests locally (not in ci). These are the dev dependencies: “cypress”: “10.8.0”, “cypress-cucumber-preprocessor”: “^4.2.0”, “cypress-real-events”: “^1.7.1”, “cypress-repeat”: “^2.3.3”, “cypress-xpath”: “1.6.2” Below is the error:

Timed out waiting for the browser to connect. Retrying...
Missing browserCriClient in connectToNewSpec
Error: Missing browserCriClient in connectToNewSpec
    at Object.connectToNewSpec (/Users/username/Library/Caches/Cypress/10.8.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/chrome.js:425:19)
    at Object.connectToNewSpec (/Users/username/Library/Caches/Cypress/10.8.0/Cypress.app/Contents/Resources/app/packages/server/lib/browsers/index.js:95:31)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at OpenProject.relaunchBrowser (/Users/username/Library/Caches/Cypress/10.8.0/Cypress.app/Contents/Resources/app/packages/server/lib/open_project.js:148:24)

I have never seen this error before. All I did was run tests, but today I managed to see it a few times already.

Happened to me also. Anything new on this issue?

One thing i did do was to update these two libraries that i had installed:

  • @cypress/webpack-preprocessor from 4.0.3 to 5.15.7
  • cypress-terminal-report from 4.1.2 to 5.0.0.

I don’t know if it was coincidence or not, but that did help improve things. It still happens, but it’s reasonably rare at the minute. Maybe happens 1/20 times, whereas before it was sometimes as bad as 1/4.

I wish i could provide a sample, but i’m under NDA.

This is currently some of our reporting 3rd party components.

    "cypress-mochawesome-reporter": "3.2.3",
    "cypress-multi-reporters": "^1.6.2",
    "cypress-terminal-report": "^5.0.0"
    "mocha-junit-reporter": "^2.2.0"