Cypress: Cypress run won’t finish, stuck while making connection to Chrome

Created on 24 Feb 2020  Β·  34Comments  Β·  Source: cypress-io/cypress

Current behavior:

I’m getting error: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying during my tests. Usually happens during one of last tests (probably the last). I have multiple Cypress projects, happens on all of them. Tests are running in parallel, on Chrome.

Test code to reproduce

Issue happens quite randomly, I’m sorry, but I cannot really give a reproducible example, since this happens in CI only. Sending screenshots.

Snímka obrazovky 2020-02-24 o 9 24 54
Snímka obrazovky 2020-02-24 o 9 24 46

Versions

Cypress 4.0.2
CI: Bitbucket Pipelines
Image: cypress/browsers:node13.6.0-chrome80-ff72

blocking chrome needs investigating bug

Most helpful comment

I assume that this problem is a copy of #7450. I solved my problem by adding the following workaround provided by @stevejefferies.

Should have added to my comment above, for those looking for a potential workaround adding the disable-gpu flag on browser launch (plugins/index.js) seems stable for me at least locally:
Cypress 4+:

module.exports = (on, config) => {
  on('before:browser:launch', (browser, launchOptions) => {
    if (browser.name === 'chrome' && browser.isHeadless) {
      launchOptions.args.push('--disable-gpu');
      return launchOptions
    }
  });
}

Or before Cypress 4:

module.exports = (on, config) => {
  on('before:browser:launch', (browser, args) => {
    if (browser.name === 'chrome' && browser.isHeadless) {
      args.push(
        '--disable-gpu'
      );
      return args;
    }
  });
}

To run all test in edge without problems, you have to extend the if condition by adding the following:

browser.name === 'edge'

Now, tests are running fine in chrome as well as in egde using headless mode.

All 34 comments

Oof, yeah, these are difficult to track down.

@flotwig will cases like this get any benefit from https://github.com/cypress-io/cypress/pull/6532 or is this a whole new case again?

@filiphric Can you also try running with DEBUG=cypress:*? Thanks!

Here it is:

 Running:  polls/survey.js                                                               (38 of 43)
  Estimated: 11 seconds
  cypress:server:run about to run spec { spec: { name: 'polls/survey.js', relative: 'tests/polls/survey.js', absolute: '/opt/atlassian/pipelines/agent/build/regression-wall/tests/polls/survey.js' }, isHeadless: true, browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '80.0.3987.87', path: 'google-chrome', majorVersion: 80, isHeadless: true, isHeaded: false } } +273ms
  cypress:server:run video recording has been enabled. video: true +0ms
  cypress:server:video capture started { command: 'ffmpeg -n 20 /root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/@ffmpeg-installer/linux-x64/ffmpeg -f image2pipe -use_wallclock_as_timestamps 1 -i pipe:0 -y -vcodec libx264 -preset ultrafast /opt/atlassian/pipelines/agent/build/regression-wall/videos/polls/survey.js.mp4' } +296ms
  cypress:server:run waiting for socket to connect and browser to launch... +23ms
  cypress:server:run waiting for socket connection... { id: 'vq2u9' } +0ms
  cypress:server:run setting Chrome properties { shouldWriteVideo: true } +1ms
  cypress:server:open_project resetting project state, preparing to launch browser +30s
  cypress:server:project resetting project instance /opt/atlassian/pipelines/agent/build/regression-wall +1s
  cypress:proxy:http:util:buffers resetting buffers +6s
  cypress:server:server Setting remoteAuth undefined +3s
  cypress:network:cors Parsed URL { port: '443', tld: 'com', domain: 'slido-staging' } +4s
  cypress:server:server Setting remoteOrigin https://sli.do +0ms
  cypress:server:server Setting remoteHostAndPort { port: '443', tld: 'com', domain: 'slido-staging' } +0ms
  cypress:server:server Setting remoteDocDomain sli.do +0ms
  cypress:server:server Getting remote state: { auth: undefined, props: { port: '443', tld: 'com', domain: 'slido-staging' }, origin: 'https://sli.do', strategy: 'http', visiting: false, domainName: 'sli.do', fileServer: null } +0ms
  cypress:server:open_project launching browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '80.0.3987.87', path: 'google-chrome', majorVersion: 80, isHeadless: true, isHeaded: false }, spec: tests/polls/survey.js +1ms
  cypress:server:browsers getBrowserLauncher { browser: { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '80.0.3987.87', path: 'google-chrome', majorVersion: 80, isHeadless: true, isHeaded: false } } +427ms
  cypress:server:browsers opening browser { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '80.0.3987.87', path: 'google-chrome', majorVersion: 80, isHeadless: true, isHeaded: false } +0ms
  cypress:server:browsers:chrome reading chrome preferences... { userDir: '/root/.config/Cypress/cy/production/browsers/chrome-stable/run-192', CHROME_PREFERENCE_PATHS: { default: 'Default/Preferences', defaultSecure: 'Default/Secure Preferences', localState: 'Local State' } } +446ms
  cypress:server:video capture stderr log { message: 'ffmpeg version N-47683-g0e8eb07980-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2018 the FFmpeg developers' } +3ms
  cypress:server:video capture stderr log { message: '  built with gcc 6.3.0 (Debian 6.3.0-18+deb9u1) 20170516' } +0ms
  cypress:server:video capture stderr log { message: '  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg' } +0ms
  cypress:server:video capture stderr log { message: '  libavutil      56. 24.101 / 56. 24.101' } +0ms
  cypress:server:video capture stderr log { message: '  libavcodec     58. 42.100 / 58. 42.100' } +0ms
  cypress:server:video capture stderr log { message: '  libavformat    58. 24.100 / 58. 24.100' } +0ms
  cypress:server:video capture stderr log { message: '  libavdevice    58.  6.101 / 58.  6.101' } +0ms
  cypress:server:video capture stderr log { message: '  libavfilter     7. 46.101 /  7. 46.101' } +0ms
  cypress:server:video capture stderr log { message: '  libswscale      5.  4.100 /  5.  4.100' } +0ms
  cypress:server:video capture stderr log { message: '  libswresample   3.  4.100 /  3.  4.100' } +0ms
  cypress:server:video capture stderr log { message: '  libpostproc    55.  4.100 / 55.  4.100' } +0ms
  cypress:server:plugins plugin event registered? { event: 'before:browser:launch', isRegistered: false } +29s
  cypress:server:browsers:chrome chrome is running headlessly, not installing extension +5ms
  cypress:server:appdata path: /root/.config/Cypress/cy/production/extensions +29s
  cypress:server:browsers:chrome launching in chrome with debugging port {
  url: 'https://sli.do/__/#/tests/integration/polls/survey.js',
   args: [
    '--test-type',
    '--ignore-certificate-errors',
    '--start-maximized',
    '--silent-debugger-extension-api',
    '--no-default-browser-check',
    '--no-first-run',
    '--noerrdialogs',
    '--enable-fixed-layout',
    '--disable-popup-blocking',
    '--disable-password-generation',
    '--disable-save-password-bubble',
    '--disable-single-click-autofill',
    '--disable-prompt-on-repos',
    '--disable-background-timer-throttling',
    '--disable-renderer-backgrounding',
    '--disable-renderer-throttling',
    '--disable-restore-session-state',
    '--disable-translate',
    '--disable-new-profile-management',
    '--disable-new-avatar-menu',
    '--allow-insecure-localhost',
    '--reduce-security-for-testing',
    '--enable-automation',
    '--disable-device-discovery-notifications',
    '--disable-infobars',
    '--autoplay-policy=no-user-gesture-required',
    '--disable-site-isolation-trials',
    '--metrics-recording-only',
    '--disable-prompt-on-repost',
    '--disable-hang-monitor',
    '--disable-sync',
    '--disable-web-resources',
    '--safebrowsing-disable-auto-update',
    '--safebrowsing-disable-download-protection',
    '--disable-client-side-phishing-detection',
    '--disable-component-update',
    '--disable-default-apps',
    '--use-fake-ui-for-media-stream',
    '--use-fake-device-for-media-stream',
    '--disable-ipc-flooding-protection',
    '--disable-backgrounding-occluded-window',
    '--disable-breakpad',
    '--password-store=basic',
    '--use-mock-keychain',
    '--disable-gpu',
    '--no-sandbox',
    '--proxy-server=http://localhost:34615',
    '--proxy-bypass-list=<-loopback>',
    '--headless',
    '--remote-debugging-port=39999',
    '--remote-debugging-address=127.0.0.1',
    '--user-data-dir=/root/.config/Cypress/cy/production/browsers/chrome-stable/run-192',
    '--disk-cache-dir=/root/.config/Cypress/cy/production/browsers/chrome-stable/run-192/CypressCache'
  ],
  port: 39999
} +0ms
cypress:launcher launching browser { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '80.0.3987.87', path: 'google-chrome', majorVersion: 80, isHeadless: true, isHeaded: false } to open about:blank +30s
  cypress:launcher spawning browser { name: 'chrome', family: 'chromium', channel: 'stable', displayName: 'Chrome', version: '80.0.3987.87', path: 'google-chrome', majorVersion: 80, isHeadless: true, isHeaded: false } with args about:blank --test-type --ignore-certificate-errors --start-maximized --silent-debugger-extension-api --no-default-browser-check --no-first-run --noerrdialogs --enable-fixed-layout --disable-popup-blocking --disable-password-generation --disable-save-password-bubble --disable-single-click-autofill --disable-prompt-on-repos --disable-background-timer-throttling --disable-renderer-backgrounding --disable-renderer-throttling --disable-restore-session-state --disable-translate --disable-new-profile-management --disable-new-avatar-menu --allow-insecure-localhost --reduce-security-for-testing --enable-automation --disable-device-discovery-notifications --disable-infobars --autoplay-policy=no-user-gesture-required --disable-site-isolation-trials --metrics-recording-only --disable-prompt-on-repost --disable-hang-monitor --disable-sync --disable-web-resources --safebrowsing-disable-auto-update --safebrowsing-disable-download-protection --disable-client-side-phishing-detection --disable-component-update --disable-default-apps --use-fake-ui-for-media-stream --use-fake-device-for-media-stream --disable-ipc-flooding-protection --disable-backgrounding-occluded-window --disable-breakpad --password-store=basic --use-mock-keychain --disable-gpu --no-sandbox --proxy-server=http://localhost:34615 --proxy-bypass-list=<-loopback> --headless --remote-debugging-port=39999 --remote-debugging-address=127.0.0.1 --user-data-dir=/root/.config/Cypress/cy/production/browsers/chrome-stable/run-192 --disk-cache-dir=/root/.config/Cypress/cy/production/browsers/chrome-stable/run-192/CypressCache +0ms
  cypress:server:browsers:chrome connecting to Chrome remote interface at random port 39999 +21ms
  cypress:server:protocol Getting WS connection to CRI on port 39999 +30s
  cypress:network:connect received error on connect, retrying { iteration: 0, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +4s
  cypress:network:connect received error on connect, retrying { iteration: 1, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +102ms
  cypress:network:connect received error on connect, retrying { iteration: 2, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +102ms
  cypress:network:connect received error on connect, retrying { iteration: 3, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +101ms
  cypress:network:connect received error on connect, retrying { iteration: 4, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +101ms
  cypress:network:connect received error on connect, retrying { iteration: 5, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +102ms
  cypress:network:connect received error on connect, retrying { iteration: 6, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +103ms
  cypress:network:connect received error on connect, retrying { iteration: 7, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +106ms
  cypress:network:connect received error on connect, retrying { iteration: 8, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +101ms
  cypress:network:connect received error on connect, retrying { iteration: 9, delay: 100, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +103ms
  cypress:network:connect received error on connect, retrying { iteration: 10, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +101ms
  cypress:network:connect received error on connect, retrying { iteration: 11, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +501ms
  cypress:network:connect received error on connect, retrying { iteration: 12, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +501ms
  cypress:network:connect received error on connect, retrying { iteration: 13, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +501ms
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  cypress:server:util:process_profiler β”‚ (index) β”‚       group       β”‚ processCount β”‚      pids       β”‚ cpuPercent β”‚ meanCpuPercent β”‚ memRssMb β”‚ meanMemRssMb β”‚ maxMemRssMb β”‚
  cypress:server:util:process_profiler β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  cypress:server:util:process_profiler β”‚    0    β”‚     'cypress'     β”‚      1       β”‚      '192'      β”‚   15.32    β”‚      8.16      β”‚  357.09  β”‚    323.73    β”‚   385.18    β”‚
  cypress:server:util:process_profiler β”‚    1    β”‚ 'electron-shared' β”‚      3       β”‚ '204, 362, 387' β”‚     0      β”‚      0.06      β”‚  140.2   β”‚    143.83    β”‚    340.4    β”‚
  cypress:server:util:process_profiler β”‚    2    β”‚     'plugin'      β”‚      1       β”‚      '442'      β”‚     0      β”‚       0        β”‚  73.74   β”‚    73.76     β”‚    74.75    β”‚
  cypress:server:util:process_profiler β”‚    3    β”‚     'ffmpeg'      β”‚      1       β”‚     '1901'      β”‚     0      β”‚      2.2       β”‚  13.13   β”‚     54.7     β”‚   176.23    β”‚
  cypress:server:util:process_profiler β”‚    4    β”‚      'other'      β”‚      2       β”‚  '1926, 1927'   β”‚     0      β”‚      0.1       β”‚   3.32   β”‚     6.49     β”‚    86.53    β”‚
  cypress:server:util:process_profiler β”‚    5    β”‚      'TOTAL'      β”‚      8       β”‚       '-'       β”‚   15.32    β”‚     19.74      β”‚  587.48  β”‚   1125.07    β”‚   1475.57   β”‚
  cypress:server:util:process_profiler β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +10s
  cypress:network:connect received error on connect, retrying { iteration: 14, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +501ms
  cypress:network:connect received error on connect, retrying { iteration: 15, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +501ms
  cypress:network:connect received error on connect, retrying { iteration: 16, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +502ms
  cypress:network:connect received error on connect, retrying { iteration: 17, delay: 500, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +502ms
Failed to connect to Chrome, retrying in 1 second (attempt 18/32)
  cypress:network:connect received error on connect, retrying { iteration: 18, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +503ms
Failed to connect to Chrome, retrying in 1 second (attempt 19/32)
  cypress:network:connect received error on connect, retrying { iteration: 19, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 20/32)
  cypress:network:connect received error on connect, retrying { iteration: 20, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 21/32)
  cypress:network:connect received error on connect, retrying { iteration: 21, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 22/32)
  cypress:network:connect received error on connect, retrying { iteration: 22, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 23/32)
cypress:network:connect received error on connect, retrying { iteration: 23, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
  cypress:network:connect received error on connect, retrying { iteration: 24, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 24/32)
Failed to connect to Chrome, retrying in 1 second (attempt 25/32)
  cypress:network:connect received error on connect, retrying { iteration: 25, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 26/32)
  cypress:network:connect received error on connect, retrying { iteration: 26, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
  cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  cypress:server:util:process_profiler β”‚ (index) β”‚       group       β”‚ processCount β”‚      pids       β”‚ cpuPercent β”‚ meanCpuPercent β”‚ memRssMb β”‚ meanMemRssMb β”‚ maxMemRssMb β”‚
  cypress:server:util:process_profiler β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  cypress:server:util:process_profiler β”‚    0    β”‚     'cypress'     β”‚      1       β”‚      '192'      β”‚    0.2     β”‚      7.88      β”‚  356.4   β”‚    324.89    β”‚   385.18    β”‚
  cypress:server:util:process_profiler β”‚    1    β”‚ 'electron-shared' β”‚      3       β”‚ '204, 362, 387' β”‚     0      β”‚      0.06      β”‚  140.2   β”‚    143.71    β”‚    340.4    β”‚
  cypress:server:util:process_profiler β”‚    2    β”‚     'plugin'      β”‚      1       β”‚      '442'      β”‚     0      β”‚       0        β”‚  73.74   β”‚    73.76     β”‚    74.75    β”‚
  cypress:server:util:process_profiler β”‚    3    β”‚     'ffmpeg'      β”‚      1       β”‚     '1901'      β”‚     0      β”‚      2.12      β”‚  13.13   β”‚    53.16     β”‚   176.23    β”‚
  cypress:server:util:process_profiler β”‚    4    β”‚      'other'      β”‚      2       β”‚  '1979, 1980'   β”‚     0      β”‚      0.1       β”‚   3.47   β”‚     6.38     β”‚    86.53    β”‚
  cypress:server:util:process_profiler β”‚    5    β”‚      'TOTAL'      β”‚      8       β”‚       '-'       β”‚    0.2     β”‚     19.04      β”‚  586.94  β”‚   1105.85    β”‚   1475.57   β”‚
  cypress:server:util:process_profiler β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +10s
Failed to connect to Chrome, retrying in 1 second (attempt 27/32)
  cypress:network:connect received error on connect, retrying { iteration: 27, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 28/32)
  cypress:network:connect received error on connect, retrying { iteration: 28, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 29/32)
  cypress:network:connect received error on connect, retrying { iteration: 29, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 30/32)
  cypress:network:connect received error on connect, retrying { iteration: 30, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 31/32)
  cypress:network:connect received error on connect, retrying { iteration: 31, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
Failed to connect to Chrome, retrying in 1 second (attempt 32/32)
  cypress:network:connect received error on connect, retrying { iteration: 32, delay: 1000, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
  cypress:network:connect retries exhausted, bubbling up error { iteration: 33, err: Error: connect ECONNREFUSED 127.0.0.1:39999     at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) { errno: 'ECONNREFUSED', code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 39999 } } +1s
  cypress:server:protocol failed to connect to CDP { connectOpts: { host: '127.0.0.1', port: 39999, getDelayMsForRetry: [Function: getDelayMsForRetry] }, err: Error: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds. This usually indicates there was a problem opening the Chrome browser. The CDP port requested was 39999. Error details: Error: connect ECONNREFUSED 127.0.0.1:39999 at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14) at get (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/lib/errors.js:344:11) at Object.throwErr [as throw] (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/lib/errors.js:359:11) at /root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/lib/browsers/protocol.js:95:17 at tryCatcher (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromise0 (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10) at Promise._settlePromises (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18) at _drainQueueStep (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12) at _drainQueue (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)     at processImmediate (internal/timers.js:439:21) { isCypressErr: true, type: 'CDP_COULD_NOT_CONNECT', details: undefined } } +20s
  cypress:server:cypress exiting with err Error: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.
This usually indicates there was a problem opening the Chrome browser.
The CDP port requested was 39999.
Error details:
Error: connect ECONNREFUSED 127.0.0.1:39999
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)

    at get (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/lib/errors.js:344:11)
    at Object.throwErr [as throw] (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/lib/errors.js:359:11)
    at /root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/lib/browsers/protocol.js:95:17
    at tryCatcher (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/root/.cache/Cypress/4.0.2/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:439:21)
 {
  isCypressErr: true,
  type: 'CDP_COULD_NOT_CONNECT',
  details: undefined
} +5m
Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.
This usually indicates there was a problem opening the Chrome browser.
The CDP port requested was 39999.
Error details:
Error: connect ECONNREFUSED 127.0.0.1:39999
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)
  cypress:server:cypress calling exit 1 +1ms
  cypress:server:cypress about to exit with code 1 +0ms
2020-02-24T19:00:53.240Z cypress:cli child event fired { event: 'exit', code: 1, signal: null }
2020-02-24T19:00:53.240Z cypress:cli child event fired { event: 'close', code: 1, signal: null }
2020-02-24T19:00:53.240Z cypress:cli Stopping Xvfb
[percy] stopping percy...
[percy] waiting for 0 snapshots to complete...
[percy] done.

@jennifer-shehane

Reporting in, I'm running into the same issue. using WSL 2 on Windows

`Title: Error launching browser

Message: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.

This usually indicates there was a problem opening the Chrome browser.

The CDP port requested was 36647.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:36647
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)

Stack trace:
```
Error: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.

This usually indicates there was a problem opening the Chrome browser.

The CDP port requested was 36647.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:36647
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1056:14)

at get (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/lib/errors.js:344:11)
at Object.throwErr [as throw] (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/lib/errors.js:359:11)
at /home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/lib/browsers/protocol.js:95:17
at tryCatcher (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
at _drainQueueStep (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/home/adomyaty/.cache/Cypress/4.1.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
at processImmediate (internal/timers.js:439:21)

````

Let me know if DEBUG is needed as well and I can provide. FYI this problem only happens when running chrome. Headless works fine. I had this problem since Cypress 3.8 or so after upgrading to 4.1 issue still persists. It working before 3.8 as far as I recall

I have another issue which might be related and shed some more light on this (or maybe not). I tried grouping my tests and calling runs using module api like this:

allGroups.forEach(group => {
  run(group); // function that calls cypress.run() and sets up config, so that each group has correct group name
});

Side note: my tests were not grouped like this when I opened the issue.

While running on multiple machines, several of them errored, but some of them finished without problems. I suspect there might be a problematic moment at the time one function finishes, and other starts.

snippet from debug, end of the run:

cypress:server:util:process_profiler current & mean memory and CPU usage by process group:
  cypress:server:util:process_profiler β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
  cypress:server:util:process_profiler β”‚ (index) β”‚       group       β”‚ processCount β”‚        pids        β”‚ cpuPercent β”‚ meanCpuPercent β”‚ memRssMb β”‚ meanMemRssMb β”‚ maxMemRssMb β”‚
  cypress:server:util:process_profiler β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
  cypress:server:util:process_profiler β”‚    0    β”‚     'cypress'     β”‚      1       β”‚       '1086'       β”‚   13.94    β”‚      6.06      β”‚  269.65  β”‚    304.46    β”‚   387.55    β”‚
  cypress:server:util:process_profiler β”‚    1    β”‚ 'electron-shared' β”‚      3       β”‚ '1099, 1643, 1729' β”‚     0      β”‚       0        β”‚  140.39  β”‚    129.08    β”‚   140.39    β”‚
  cypress:server:util:process_profiler β”‚    2    β”‚     'plugin'      β”‚      1       β”‚       '1897'       β”‚     0      β”‚      0.23      β”‚  83.49   β”‚    140.98    β”‚   549.96    β”‚
  cypress:server:util:process_profiler β”‚    3    β”‚      'other'      β”‚      2       β”‚    '4675, 4678'    β”‚     0      β”‚       0        β”‚   3.38   β”‚     3.41     β”‚    3.46     β”‚
  cypress:server:util:process_profiler β”‚    4    β”‚      'TOTAL'      β”‚      7       β”‚        '-'         β”‚   13.94    β”‚      9.59      β”‚  496.91  β”‚    867.74    β”‚   1493.33   β”‚
  cypress:server:util:process_profiler β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ +10s
  cypress:server:cypress about to exit with code 0 +1m
2020-03-18T08:47:27.183Z cypress:cli child event fired { event: 'exit', code: 0, signal: null }
2020-03-18T08:47:27.183Z cypress:cli child event fired { event: 'close', code: 0, signal: null }
2020-03-18T08:47:27.183Z cypress:cli Stopping Xvfb
[1095:0318/084727.183888:ERROR:electron_browser_main_parts.cc(199)] X IO error received (X server probably went away)
[1606:0318/084727.184901:ERROR:x11_util.cc(109)] X IO error received (X server probably went away)
[1095:0318/084727.192208:WARNING:gpu_process_host.cc(1166)] The GPU process has crashed 1 time(s)
2020-03-18T08:47:27.277Z cypress:cli child event fired { event: 'exit', code: 1, signal: null }

then I deleted the forEach loop, problem went away, although I’m still experiencing issue I’m mentioning at the beginning of this thread from time to time.

Ubuntu 19, Chromium, Version 80.0.3987.149 (Official Build) snap (64-bit)
-hosts file is only 127.0.0.1 #commented out everything else
Title: Error launching browser

Message: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.

This usually indicates there was a problem opening the Chrome browser.

The CDP port requested was 36771.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:36771
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)

Stack trace:

Error: Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds.

This usually indicates there was a problem opening the Chrome browser.

The CDP port requested was 36771.

Error details:

Error: connect ECONNREFUSED 127.0.0.1:36771
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14)

    at get (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/lib/errors.js:348:11)
    at Object.throwErr [as throw] (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/lib/errors.js:363:11)
    at /home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/lib/browsers/protocol.js:95:17
    at tryCatcher (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/home/sqa/.cache/Cypress/4.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/async.js:15:14)
    at processImmediate (internal/timers.js:439:21)

@tipsey same config . how to fix it ?

I think the problem on Ubuntu 19 is Chromium is installed via SNAP process. Cypress works on Electron and Firefox(Beta) but I don't want to try a Deb install on Ubuntu because it may break future Chromium releases. I found a Link to do this but don't want to toast my Ubunut: https://shevchuk.co/notes/2019/12/13/install-chromium-on-ubuntu-1910-from-debian-instead-of-snap

@tipsey same config . how to fix it ?

I think the problem on Ubuntu 19 is Chromium is installed via SNAP process. Cypress works on Electron and Firefox(Beta) but I don't want to try a Deb install on Ubuntu because it may break future Chromium releases. I found a Link to do this but don't want to toast my Ubunut: https://shevchuk.co/notes/2019/12/13/install-chromium-on-ubuntu-1910-from-debian-instead-of-snap

I have the same problem when I do cypress open

:~$ lsb_release -d
Description:    Ubuntu 18.04.3 LTS

:~$ chromium --version
Chromium 80.0.3987.163 snap

:~$ which chromium
/snap/bin/chromium

what's interesting is the tests run fine doing cypress run --headed

Same problem here, a downgrade to 4.2.0 can solve it?

I've had this problem with Chrome too and after a bit of investigation I'm wondering if it has something to do with a change in Chrome itself. I've had this or similar issues definitely on Chrome 80 and 81 and different versions of Cypress with the latest 4.4.1 still an issue.

When Cypress opens Chrome it does so with a large number of parameters. One of those parameters is proxy-bypass-list

Using a simplified version, when Chrome is opened like this it fails:
chrome.exe "about:blank" --enable-automation --safebrowsing-disable-auto-update --test-type --proxy-bypass-list=<-loopback>

However, if the loopback value is quoted then Chrome starts quite happily:
chrome.exe "about:blank" --enable-automation --safebrowsing-disable-auto-update --test-type --proxy-bypass-list="<-loopback>"

Is there a simple workaround by setting the proxy bypass list?

I tested the 4.2.0 version and the error does not occur anymore. So, like @79it said, I think that problem is related to Chrome.

Editing, the error happened again in the old Cypress version. :(

@79it You can modify the launch args sent to Chrome by following the instructions here: https://on.cypress.io/browser-launch-api#Modify-browser-launch-arguments

I've reviewed the comments/logs here and have not found many commonalities between the environments across people reporting this problem. A couple of things that are common:

  1. All running in Chrome headless
  2. Reported in Cypress versions 4+
  3. Error appears after running a large number of spec files?

I haven't fully verified the 3rd assertion, but from the few logs provided, they all indicated that the error occurred after a large number of spec files ran (38+).

Some questions:

Please if you can answer the questions below if you're experiencing this issue.

  • How many spec files run on a single machine until this error occurs?
  • How much time does cypress run on the single machine until this error occurs?
  • Has anyone ever seen this error on the first specfile launch?

I guess my theory is that this may be related to longer runs or runs that connect to the CDP several times over several spec files.

Also, tracking these debug logs specifically may be helpful in seeing if any leftover processes haven't existed properly. DEBUG=cypress:*,cypress-verbose:server:util:process_profiler

Hey @jennifer-shehane thank you for taking a look into it. I have been experiencing this lot less recently, but I can’t put my finger down on what might have caused this.

to answer your questions:

  • yes, our runs usually have around 15 specs on each machine, 10 machines in total
  • each machine runs for about 8 to 10 minutes
  • no, I haven’t seen this on first spec ever. it was always on the last test of very last spec on very last machine

I’ll make sure to run with a debug if it might happen in close future

@tipsey same config . how to fix it ?

@tipsey same config . how to fix it ?

Okay it's working now with Cyoress 4.5.0 and Chromium 81.0.4044.138. Just running the spec files that came with a typical Cypress Install.

I have found a workaround that worked in my Mac.

I run cypress through the API:

const cypress = require("cypress");
const path = require("path");
const configFile = path.resolve("cypress.json");
cypress.open({ configFile });

I face a similar issue running my tests in browser edge 83. It is hard to reproduce the issue, since it happens quite randomly. Like mentioned above, usually one of the last tests fails. When I'm running my tests in egde in mode headed, all tests running fine.

Current Setup:

  • Windows 10
  • Cypress Version 4.7.0
  • Browser Edge 83

I'm running my tests local with the command: npx cypress run --browser edge --headless

I get the following error:
Error_Msg

Browser launch arguments:

Browser_Args

I assume that this problem is a copy of #7450. I solved my problem by adding the following workaround provided by @stevejefferies.

Should have added to my comment above, for those looking for a potential workaround adding the disable-gpu flag on browser launch (plugins/index.js) seems stable for me at least locally:
Cypress 4+:

module.exports = (on, config) => {
  on('before:browser:launch', (browser, launchOptions) => {
    if (browser.name === 'chrome' && browser.isHeadless) {
      launchOptions.args.push('--disable-gpu');
      return launchOptions
    }
  });
}

Or before Cypress 4:

module.exports = (on, config) => {
  on('before:browser:launch', (browser, args) => {
    if (browser.name === 'chrome' && browser.isHeadless) {
      args.push(
        '--disable-gpu'
      );
      return args;
    }
  });
}

To run all test in edge without problems, you have to extend the if condition by adding the following:

browser.name === 'edge'

Now, tests are running fine in chrome as well as in egde using headless mode.

@simisimon that fixed worked for me. Thank you! :)

@simisimon that fixed worked for me. Thank you! :)

Me too! Thanks! :D

@simisimon !!! now we can finally run in chrome! every test file now runs 10-20 seconds faster THX πŸ‘ πŸ₯‡

I also faced with this issue running tests in Docker container based on cypress/included:4.5.0 in Travis CI.

screenshot_41

@jennifer-shehane here is the data you asked:

How many spec files run on a single machine until this error occurs?

Ran 5 specs and after that got the error.

How much time does cypress run on the single machine until this error occurs?

It took 2m51s in general.

Has anyone ever seen this error on the first specfile launch?

no.

Browser launch arguments:

cypress:launcher launching browser { 
  browser: { 
    name: 'chrome',
      family: 'chromium',
      channel: 'stable',
      displayName: 'Chrome',
      version: '80.0.3987.116',
      path: 'google-chrome',
      majorVersion: 80,
      isHeadless: true,
      isHeaded: false 
  }, 
  url: 'about:blank' 
}
cypress:launcher spawning browser with args { 
  args: [ 
    'about:blank',
    '--test-type',
    '--ignore-certificate-errors',
    '--start-maximized',
    '--silent-debugger-extension-api',
    '--no-default-browser-check',
    '--no-first-run', '--noerrdialogs',
    '--enable-fixed-layout', '--disable-popup-blocking',
    '--disable-password-generation',
    '--disable-save-password-bubble',
    '--disable-single-click-autofill',
    '--disable-prompt-on-repos',
    '--disable-background-timer-throttling',
    '--disable-renderer-backgrounding',
    '--disable-renderer-throttling',
    '--disable-restore-session-state',
    '--disable-translate',
    '--disable-new-profile-management',
    '--disable-new-avatar-menu',
    '--allow-insecure-localhost',
    '--reduce-security-for-testing',
    '--enable-automation',
    '--disable-device-discovery-notifications',
    '--disable-infobars',
    '--autoplay-policy=no-user-gesture-required',
    '--disable-site-isolation-trials',
    '--metrics-recording-only',
    '--disable-prompt-on-repost', 
    '--disable-hang-monitor', 
    '--disable-sync', 
    '--disable-web-resources', 
    '--safebrowsing-disable-auto-update', 
    '--safebrowsing-disable-download-protection', 
    '--disable-client-side-phishing-detection', 
    '--disable-component-update', 
    '--disable-default-apps', 
    '--use-fake-ui-for-media-stream', 
    '--use-fake-device-for-media-stream', 
    '--disable-ipc-flooding-protection', 
    '--disable-backgrounding-occluded-window', 
    '--disable-breakpad', 
    '--password-store=basic', 
    '--use-mock-keychain', 
    '--disable-gpu', // as I see it's already enabled for linux os, but still doesn't solve the issue : (
    '--no-sandbox', 
    '--proxy-server=http://localhost:36939', 
    '--disable-web-security',
    '--allow-running-insecure-content',
    '--proxy-bypass-list=<-loopback>', 
    '--headless', '--window-size=1280,720',
    '--remote-debugging-port=46485', 
    '--remote-debugging-address=127.0.0.1',
    '--disable-dev-shm-usage', // custom set arg
    '--cast-initial-screen-width=1600', // custom set arg
    '--cast-initial-screen-height=900', // custom set arg
    '--user-data-dir=/root/.config/Cypress/cy/production/browsers/chrome-stable/run-17',
    '--disk-cache-dir=/root/.config/Cypress/cy/production/browsers/chrome-stable/run-17/CypressCache' 
  ] 
}

@simisimon working

@simisimon That doesn't work for me, unfortunately

I was missing the line

127.0.0.1 localhost
in my /etc/hosts file. Afterwards it worked perfectly!

I was missing the line

127.0.0.1 localhost
in my /etc/hosts file. Afterwards it worked perfectly!

This was the fix for me! Thank you!

@flotwig why would 127.0.0.1 localhost be important for some situations?

I was missing the line

127.0.0.1 localhost
in my /etc/hosts file. Afterwards it worked perfectly!

this solve my problem too, very much Thanks to you!

why would 127.0.0.1 localhost be important for some situations?

@bahmutov not sure, as of 3.8.1 we explicitly connect to 127.0.0.1 to avoid this exact situation: https://github.com/cypress-io/cypress/blob/57f5f9a1e4bac4d49c134add69401fa84bb95517/packages/server/lib/browsers/protocol.ts#L88-L96

@flotwig @bahmutov
hi, I'm starting to facing this issue again while execute with "-b chrome --headless"
previously, that fix worked for me :

module.exports = (on, config) => {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--disable-gpu');
return launchOptions
}
});
}

now I'm getting the same error

"Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 50 seconds.
This usually indicates there was a problem opening the Chrome browser.
The CDP port requested was 52419.
Error details: Error: could not find CRI target"

also added 127.0.0.1 localhost - not helped(also tried to add my test domains to localhost file)

CYPRESS NOT BEING ABLE TO CONNECT TO CHROME 86

Hi, I am facing the same issue of Cypress not being able to connect to Chrome. If I try to run my tests using Firefox Beta or Electron, it works. What's the problem with Chrome?

I have added the following code, but the problem persists. I mention the fact that everything worked fine until yesterday.
module.exports = (on, config) => {
on('before:browser:launch', (browser, launchOptions) => {
if (browser.name === 'chrome' && browser.isHeadless) {
launchOptions.args.push('--disable-gpu');
return launchOptions
}
});
}

Same with me.. tests doesn't not start to run on Windows 10, Chrome Version 86.0.4240.183 (Official Build) (64-bit). With Firefox everything works

Was this page helpful?
0 / 5 - 0 ratings