cypress: ECONNRESET on Chrome/Chromium 117.0.5851.0 when using Cypress <12.15.0 or passing`--headless=old` in browser launch options

Latest update:

https://github.com/cypress-io/cypress/issues/27804#issuecomment-1721476731


Current behavior

Right now when running against latest Chrome which released 18 hours ago for linux and max and using --headless=old (because we’re getting browser freezes / unresponsiveness with new headless mode), you get ECONNRESET error code while cypress is trying to connect to headless chrome:

https://app.warp.dev/block/7kDNSkJQ4CtNDhMXPe3CRt

With DEBUG=cypress:server:util:process_profiler:

https://app.warp.dev/block/c2Par9SHLXvmbpt2Edtj90

With DEBUG=cypress:*

https://app.warp.dev/block/cJRcQGlGK0MVSaCHRd0xy9

Of interest:

  cypress:launcher:browsers chrome stderr: DevTools listening on ws://*********:62486/devtools/browser/************************************ +163ms
  cypress:network:connect successfully connected { opts: { host: '*********', port: 62486, getDelayMsForRetry: [Function: getDelayMsForRetry] }, iteration: 2 } +105ms
  cypress:launcher:browsers chrome stderr: [0913/112049.992673:WARNING:crash_report_exception_handler.cc(235)] UniversalExceptionRaise: (os/kern) failure (5) +167ms
read ECONNRESET
Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
  cypress:server:browsers:browser-cri-client error finding browser target, maybe retrying { delay: 100, err: Error: read ECONNRESET     at TCP.onStreamRead (node:internal/stream_base_commons:217:20) { errno: -54, code: 'ECONNRESET', syscall: 'read' } } +0ms
  cypress:launcher:browsers chrome exited: { code: null, signal: 'SIGSEGV' } +4ms

Desired behavior

Run tests 😃

Test code to reproduce

We have this currently to use the old headless mode and removing it makes it work:

  on('before:browser:launch', (browser = {}, launchOptions) => {
    if (browser.name === 'chrome' && browser.isHeadless) {
      launchOptions.args.push('--headless=old');
    }
    return launchOptions;
  });

Cypress Version

12.17.3

Node version

16.16.0

Operating System

macOS 13.5.1 (22G90) and linux (debian)

Debug Logs

See description.

Other

No response

About this issue

  • Original URL
  • State: closed
  • Created 10 months ago
  • Reactions: 30
  • Comments: 49 (38 by maintainers)

Commits related to this issue

Most upvoted comments

If anyone is seeing this issue on Cypress versions 12.14.0 and earlier and can use the --headless=new flag (which is the default from Cypress version 12.15.0 and afterward), you can tell Chrome to use the option by adding the following to your setupNodeEvents:

setupNodeEvents(on, config) {
  on('before:browser:launch', (browser, launchOptions) => {
    if (browser.name === 'chrome' && browser.isHeadless) {
      launchOptions.args = launchOptions.args.map((arg) => {
        if (arg === '--headless') {
          return '--headless=new'
        }
  
        return arg
      })
    }
  
    return launchOptions
  })
}

We’re investigating this issue currently.

Just clarifying the issue and who it’s affecting:

  • There’s an issue where users using Chrome 117.0.5851.0+ will see an ECONNRESET error when running via cypress run in all OS’s if they are using:
    • Cypress version <12.15.0. The--headless=new flag was introduced and is passed by default in 12.15.0.
    • Cypress version 12.15.0+ and manually passing a --headless=old flag.

Root cause:

  • This is an issue introduced by Chrome in version 117.0.5851.0. We’ve opened an issue with them detailing the issue and are awaiting their response.

Available workarounds:

  • Downgrade Chrome to Chrome 116 (or technically Chrome 117.0.5849.0).
  • Update to use Chrome Canary 119.0.6017.1
  • Upgrade to Cypress 12.15.0 if on an earlier version.
  • For users that cannot upgrade to Cypress 12.15.0, they can pass the --headless=new flag manually as described here.
  • Remove passing --headless=old from your test run.
  • Pass --headed to your test run (note, this may change the behavior of tests).

If you are encountering issues with any of these workarounds, please detail those issues and open an issue in GitHub. There are some users reporting hanging with the headless=new flag in Cypress, but we don’t have a way to reproduce that yet and would love to fix that.

We don’t expect Chrome to support the --headless=old flag forever, so fixing issues with the --headless=new flag are high priority to us.

I can confirm Google Chrome / Chromium Linux 117.0.5938.132 no longer has this issue

On Windows/Mac it is slowly rolling out

GitHub is now rolling out runner-images 20230915 - 20230918 with Chrome, Chromium & Edge 117 version browsers. Until the roll-out has completed an old version image or a new version image is randomly triggered. It is also possible to see a workflow using different versions for different jobs in the same workflow where there is more than one job triggered.

So it is likely that default GitHub Actions workflows with Cypress < version 12.15.0 testing against any of the Chromium family browsers will start seeing failures.

For workarounds, see previous comments.

image

Edit: All rollouts updating Chromium family browsers (including Chrome) to 117 have reached 100%. If you have a GitHub workflow running with default settings you will certainly be picking up this version. In the meantime a new set of rollouts has started which update to a later 117 patch level e.g. on ubuntu-22.04 from 117.0.5938.88 to 117.0.5938.92. (Only macOS 13 beta is lagging behind.)

I was able to reproduce the issue outside of Cypress in standalone Chrome. I’ve logged a Chromium bug.

@jennifer-shehane

  • Chromium team fixed the issue
  • Fix is currently in Chrome Canary 119 and will be in the next dev/beta/stable build

Same issue here, had to downgrade to 116 version to make it works

GitHub is preparing to roll out browser fixes, for example through:

So it is likely that default GitHub Actions workflows with Cypress < version 12.15.0 testing against any of the Chromium family browsers will start seeing failures.

As further confirmation: I began seeing this exact failure case today with GitHub Actions using Cypress 12.5.1. It would happen on occasion, happening more and more throughout the day, I imagine as the newer Actions rolled out.

Upgrading to Cypress 12.17.0 seems to have fixed it.

I understand from your post in Chromium bug 1483163 that you were able to test a Canary release successfully. Is that correct? Which exact build / operating system did you use?

Yes, 119.0.6016.0 Windows x64

I think the title of this issue should be changed to include Chromium since Chrome is not the only chromium browser with this issue

Hi! For 12.4.0 cypress and Chrome 117 the following solution works:

cypress.config.ts

setupNodeEvents(on, config) {
            on(
                'before:browser:launch',
                (browser: Browser, launchOptions: BrowserLaunchOptions) => {
                    if (browser.name === 'chrome' && browser.isHeadless) {
                        const headlessIndex =
                            launchOptions.args.indexOf('--headless');
                        if (headlessIndex > -1) {
                            launchOptions.args[headlessIndex] =
                                '--headless=new';
                        }
                    }
                    return launchOptions;
                },
            );
            return require('./cypress/plugins/index.ts')(on, config);
        },

this solution doesn’t work for me:

launchOptions.args = launchOptions.args.map((arg) => {
        if (arg === '--headless') {
          return '--headless=new'
        }

@MikeMcC399 Thanks, updated my comment to be clearer.

@mschile can you pin this issue?

This is how I explained it in the bug report comments


image

I tested on my Windows machine with --headless and it has the same issue as --headless=old, I’ll make a new comment on the bug report

Thank you @alexsch01 for confirming and following up in the Chromium bug report! I would consider --headless not working as a higher priority regression than if just --headless=old didn’t work, but I guess that will be up to the Chromium team to prioritize.

@MikeMcC399 I tested on my Windows machine with --headless and it has the same issue as --headless=old, I’ll make a new comment on the bug report