cypress: Cypress 3.8.1 with Google Chrome 79 sometimes failing with "Cypress failed to make a connection to the Chrome DevTools Protocol after retrying for 20 seconds."

Current behavior:

Using Cypress 3.8.1 with Google Chrome 79 tests sometimes failing with the error:

  Running:  e2e/mycooltest.js                                               (15 of 28)
Failed to connect to Chrome, retrying in 1 second (attempt 18/32)
Failed to connect to Chrome, retrying in 1 second (attempt 19/32)
Failed to connect to Chrome, retrying in 1 second (attempt 20/32)
Failed to connect to Chrome, retrying in 1 second (attempt 21/32)
Failed to connect to Chrome, retrying in 1 second (attempt 22/32)
Failed to connect to Chrome, retrying in 1 second (attempt 23/32)
Failed to connect to Chrome, retrying in 1 second (attempt 24/32)
Failed to connect to Chrome, retrying in 1 second (attempt 25/32)
Failed to connect to Chrome, retrying in 1 second (attempt 26/32)
Failed to connect to Chrome, retrying in 1 second (attempt 27/32)
Failed to connect to Chrome, retrying in 1 second (attempt 28/32)
Failed to connect to Chrome, retrying in 1 second (attempt 29/32)
Failed to connect to Chrome, retrying in 1 second (attempt 30/32)
Failed to connect to Chrome, retrying in 1 second (attempt 31/32)
Failed to connect to Chrome, retrying in 1 second (attempt 32/32)
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 42207.

Error details:

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

It always seems to happen on starting new test, never in the middle of a test.

Desired behavior:

Cypress always can connect to chrome when it’s needed.

Test code to reproduce

Can’t see any specific patterns. Seems to happens time to time in random places.

Versions

Cypress - 3.8.1 Google Chrome - 79 Cypress docker image - cypress/browsers:node13.3.0-chrome79-ff70 OS - ubuntu xenial

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 17 (5 by maintainers)

Most upvoted comments

I experience this too with latest “cypress”: “4.4.1”.

Sometimes, not everytime and without any code change, I get this error at the middle of the tests. As @sergeyKhristenko said, always when cypress starts a new test in my all tests suite, not in middle of one test.

Very difficult to reproduce as it happens quite randomly.

Hi, I have a similar error on Chromium 80 with Cypress 4.1:

The CDP port requested was 37435.

Error details:

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

There is no step to reproduce except following the getting started tutorial, it fails when running the test.

Hi there,

I have a similar error:

  • For me, It is always happening start from the 2nd test Cucumber BDD feature file.
  • Chrome: Version 81.0.4044.129 (Official Build) (64-bit)
  • Dependencies: “cypress”: “^4.10.0”, “cypress-cucumber-preprocessor”: “^2.5.4”, “cypress-image-snapshot”: “^3.1.1”, “cypress-wait-until”: “^1.7.1”, “multiple-cucumber-html-reporter”: “^1.17.0”

`Timed out waiting for the browser to connect. Retrying… Failed to connect to Chrome, retrying in 1 second (attempt 18/62) Failed to connect to Chrome, retrying in 1 second (attempt 19/62) Failed to connect to Chrome, retrying in 1 second (attempt 20/62) Failed to connect to Chrome, retrying in 1 second (attempt 21/62) Failed to connect to Chrome, retrying in 1 second (attempt 22/62) Failed to connect to Chrome, retrying in 1 second (attempt 23/62) Failed to connect to Chrome, retrying in 1 second (attempt 24/62) Failed to connect to Chrome, retrying in 1 second (attempt 25/62) Failed to connect to Chrome, retrying in 1 second (attempt 26/62) Failed to connect to Chrome, retrying in 1 second (attempt 27/62) Failed to connect to Chrome, retrying in 1 second (attempt 28/62) Failed to connect to Chrome, retrying in 1 second (attempt 29/62) Failed to connect to Chrome, retrying in 1 second (attempt 30/62) Failed to connect to Chrome, retrying in 1 second (attempt 31/62) Failed to connect to Chrome, retrying in 1 second (attempt 32/62) Failed to connect to Chrome, retrying in 1 second (attempt 33/62) Failed to connect to Chrome, retrying in 1 second (attempt 34/62) Failed to connect to Chrome, retrying in 1 second (attempt 35/62) Failed to connect to Chrome, retrying in 1 second (attempt 36/62) Failed to connect to Chrome, retrying in 1 second (attempt 37/62) Failed to connect to Chrome, retrying in 1 second (attempt 38/62) Failed to connect to Chrome, retrying in 1 second (attempt 39/62) Failed to connect to Chrome, retrying in 1 second (attempt 40/62) Failed to connect to Chrome, retrying in 1 second (attempt 41/62) Failed to connect to Chrome, retrying in 1 second (attempt 42/62) Failed to connect to Chrome, retrying in 1 second (attempt 43/62) Failed to connect to Chrome, retrying in 1 second (attempt 44/62) Failed to connect to Chrome, retrying in 1 second (attempt 45/62) Failed to connect to Chrome, retrying in 1 second (attempt 46/62) Failed to connect to Chrome, retrying in 1 second (attempt 47/62) Failed to connect to Chrome, retrying in 1 second (attempt 48/62) Failed to connect to Chrome, retrying in 1 second (attempt 49/62) Failed to connect to Chrome, retrying in 1 second (attempt 50/62) Failed to connect to Chrome, retrying in 1 second (attempt 51/62) Failed to connect to Chrome, retrying in 1 second (attempt 52/62) Failed to connect to Chrome, retrying in 1 second (attempt 53/62) Failed to connect to Chrome, retrying in 1 second (attempt 54/62) Failed to connect to Chrome, retrying in 1 second (attempt 55/62) Failed to connect to Chrome, retrying in 1 second (attempt 56/62) Failed to connect to Chrome, retrying in 1 second (attempt 57/62) Failed to connect to Chrome, retrying in 1 second (attempt 58/62) Failed to connect to Chrome, retrying in 1 second (attempt 59/62) Failed to connect to Chrome, retrying in 1 second (attempt 60/62) Failed to connect to Chrome, retrying in 1 second (attempt 61/62) Failed to connect to Chrome, retrying in 1 second (attempt 62/62) 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 49379.

Error details:

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

It is worth to mention it is always happening after the 18th attempt Failed to connect to Chrome, retrying in 1 second (attempt 18/62).

It is worth to mention it is always happening after the 18th attempt Failed to connect to Chrome, retrying in 1 second (attempt 18/62).

I can confirm this from my end, always failed on the 18th

Tests are slow, so you say run headless chrome it is faster… but headless chrome fails to connect 80% of the time…

Do a $ps aux | grep cypress and then kill all the zombi processes 😃

THIS FIXES THIS PROBLEM!!! by @simisimon in #6540 (comment)_

Thank you. Helped me

3.8.1 isn’t the latest release. Have you tested with 3.8.3?