Cypress: Cypress hangs during execution of test suite

Created on 10 Mar 2020  Â·  23Comments  Â·  Source: cypress-io/cypress

Current behavior:

During a test run Cypress hangs and never exit, it doesn't print anything in the stdout while it's blocked.

From the DEBUG log can be seen that it goes in a kind of loop and prints cypress:server:util:process_profiler current & mean memory and CPU usage by process group every 10 seconds until is terminated by the CI timeout

Desired behavior:

Cypress doesn't hang and instead fails if something goes wrong.

Test code to reproduce

It's not happening 100% of the times so I don't know what's the root cause, however I've attached a debug log

Versions

Cypress 4.0.2 - Chrome 78/Firefox 70.0.1 - Unix
executionLogRedacted.txt

needs information EPIPE bug

Most helpful comment

Please I have this problem of running it locally ... it hangs from time to time on headless mode with chrome ... any ideas ?

All 23 comments

When running DEBUG logs, the memory table by default prints every 10 seconds, so this just means that Cypress has hung for some reason.

The CPU however does not look to be maxed out, so this is likely not be related to the machine's resources.

  • You mentioned Chrome 78 this is also happening within? So this is not solely isolated to Firefox?

If that is the case, there's likely something in the test code that is triggering Cypress to hang for some reason. We'll would need a way to reproduce this locally in order to look into it further.

Yes is also failing on Chrome. Interestingly on Chrome I can also see request call to weird domains that are not starting from our App. Is that normal or can be a hint?

The same test was passing on Chrome with Cypress 3.8.2

I've upgraded Cypress to 4.1.0. but the error persist.

Unfortunately I cannot share the test I cannot reproduce it with another test suite

Also, locally works fine (Mac) either via visual mode or from terminal.

2020-03-11T13:40:32.858Z cypress:network:connect error getting address { hostname: 'ifnaloopr', port: 80, err: OperationalError: getaddrinfo ENOTFOUND ifnaloopr at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { cause: Error: getaddrinfo ENOTFOUND ifnaloopr at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'ifnaloopr' }, isOperational: true, errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'ifnaloopr' } } 2020-03-11T13:40:32.859Z cypress:network:agent got family { family: undefined, href: 'http://ifnaloopr/' } 2020-03-11T13:40:32.859Z cypress:server:request received an error making http request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://zdbjukjz/', requestId: 'request803', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [ 200 ], err: Error: getaddrinfo ENOTFOUND zdbjukjz at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'zdbjukjz' } } 2020-03-11T13:40:32.859Z cypress:server:request retrying request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://zdbjukjz/', requestId: 'request803', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], delay: 200, attempt: 4 } 2020-03-11T13:40:32.860Z cypress:server:request received an error making http request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://oteqmufdmofygeh/', requestId: 'request804', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [ 200 ], err: Error: getaddrinfo ENOTFOUND oteqmufdmofygeh at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'oteqmufdmofygeh' } } 2020-03-11T13:40:32.860Z cypress:server:request retrying request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://oteqmufdmofygeh/', requestId: 'request804', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], delay: 200, attempt: 4 } 2020-03-11T13:40:32.861Z cypress:server:request received an error making http request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://ifnaloopr/', requestId: 'request805', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [ 200 ], err: Error: getaddrinfo ENOTFOUND ifnaloopr at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'ifnaloopr' } } 2020-03-11T13:40:32.861Z cypress:server:request retrying request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://ifnaloopr/', requestId: 'request805', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], delay: 200, attempt: 4 } 2020-03-11T13:40:33.060Z cypress:server:stream_buffer buffered stream EOF { readerId: 'reader815' } 2020-03-11T13:40:33.060Z cypress:network:agent addRequest called { isHttps: false, href: 'http://zdbjukjz/' } 2020-03-11T13:40:33.060Z cypress:network:connect beginning getAddress { hostname: 'zdbjukjz', port: 80 } 2020-03-11T13:40:33.060Z cypress:server:stream_buffer buffered stream EOF { readerId: 'reader816' } 2020-03-11T13:40:33.060Z cypress:network:agent addRequest called { isHttps: false, href: 'http://oteqmufdmofygeh/' } 2020-03-11T13:40:33.061Z cypress:network:connect beginning getAddress { hostname: 'oteqmufdmofygeh', port: 80 } 2020-03-11T13:40:33.061Z cypress:server:stream_buffer buffered stream EOF { readerId: 'reader817' } 2020-03-11T13:40:33.061Z cypress:network:agent addRequest called { isHttps: false, href: 'http://ifnaloopr/' } 2020-03-11T13:40:33.061Z cypress:network:connect beginning getAddress { hostname: 'ifnaloopr', port: 80 } 2020-03-11T13:40:33.062Z cypress:network:connect error getting address { hostname: 'zdbjukjz', port: 80, err: OperationalError: getaddrinfo ENOTFOUND zdbjukjz at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { cause: Error: getaddrinfo ENOTFOUND zdbjukjz at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'zdbjukjz' }, isOperational: true, errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'zdbjukjz' } } 2020-03-11T13:40:33.062Z cypress:network:agent got family { family: undefined, href: 'http://zdbjukjz/' } 2020-03-11T13:40:33.062Z cypress:network:connect error getting address { hostname: 'oteqmufdmofygeh', port: 80, err: OperationalError: getaddrinfo ENOTFOUND oteqmufdmofygeh at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { cause: Error: getaddrinfo ENOTFOUND oteqmufdmofygeh at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'oteqmufdmofygeh' }, isOperational: true, errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'oteqmufdmofygeh' } } 2020-03-11T13:40:33.062Z cypress:network:agent got family { family: undefined, href: 'http://oteqmufdmofygeh/' } 2020-03-11T13:40:33.063Z cypress:network:connect error getting address { hostname: 'ifnaloopr', port: 80, err: OperationalError: getaddrinfo ENOTFOUND ifnaloopr at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { cause: Error: getaddrinfo ENOTFOUND ifnaloopr at GetAddrInfoReqWrap.onlookupall [as oncomplete] (dns.js:72:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'ifnaloopr' }, isOperational: true, errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'ifnaloopr' } } 2020-03-11T13:40:33.063Z cypress:network:agent got family { family: undefined, href: 'http://ifnaloopr/' } 2020-03-11T13:40:33.064Z cypress:server:request received an error making http request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://zdbjukjz/', requestId: 'request803', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], err: Error: getaddrinfo ENOTFOUND zdbjukjz at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'zdbjukjz' } } 2020-03-11T13:40:33.064Z cypress:server:request exhausted all attempts retrying request { timeout: 30000, retryIntervals: [ 0, 100, 200, 200 ], url: 'http://zdbjukjz/', requestId: 'request803', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], err: Error: getaddrinfo ENOTFOUND zdbjukjz at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'zdbjukjz' } } 2020-03-11T13:40:33.064Z cypress:proxy:http Error in middleware { stage: 'IncomingRequest', middlewareName: 'SendRequestOutgoing', error: Error: getaddrinfo ENOTFOUND zdbjukjz at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26) { errno: 'ENOTFOUND', code: 'ENOTFOUND', syscall: 'getaddrinfo', hostname: 'zdbjukjz' } } 2020-03-11T13:40:33.064Z cypress:proxy:http Entering stage { stage: 'Error' }

The Chrome requests to weird domains is normal behavior, see here: #3151

With v3.8.2 it always passes on Electron, hangs often of on Chrome

Compared two stacktraces, same test and configuration: pass on Electron, hangs 50% Chrome.
The difference is that on Chrome there are two requests (or more) that are aborted
2020-03-17T18:20:33.272Z cypress:proxy:http:request-middleware request aborted 2020-03-17T18:20:33.272Z cypress:server:request aborting { requestId: 'request21' } 2020-03-17T18:20:33.273Z cypress:proxy:http:request-middleware request aborted 2020-03-17T18:20:33.273Z cypress:server:request aborting { requestId: 'request23' } 2020-03-17T18:20:33.274Z cypress:https-proxy Making intercepted connection to 40353
From this point, Cypress will be hanging until terminated from the CI timeout

I'm also seeing cypress hanging, how does one obtain the Debug logs? Is it possible to print them to a file, since I cannot log in to my CI instance?

I can see something like this:

  cypress:server:server Got CONNECT request from safebrowsing.googleapis.com:443 +4m
  cypress:https-proxy Writing browserSocket connection headers { url: 'safebrowsing.googleapis.com:443', headLength: 0, headers: { host: 'safebrowsing.googleapis.com:443', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/79.0.3945.79 Chrome/79.0.3945.79 Safari/537.36' } } +4m
  cypress:https-proxy Got first head bytes { url: 'safebrowsing.googleapis.com:443', head: '\u0016\u0003\u0001\u0002\u0000\u0001\u0000\u0001�\u0003\u00039�B.��\u000b�@��\u0001\u0006�\u001c\b$.\u0010ھ�\u0018I?aI@pu;� \u000b����6\u0017\u0004ZN�ߪ���w�6�Wq' } +1ms
  cypress:network:cors Parsed URL { port: '443', tld: 'googleapis.com', domain: 'safebrowsing' } +4m
  cypress:server:server HTTPS request does not match URL: https://safebrowsing.googleapis.com:443 with props: { port: '443', tld: 'com', domain: 'XXX' } +1ms
  cypress:https-proxy Making connection to safebrowsing.googleapis.com:443 +0ms
  cypress:https-proxy getting proxy URL { port: 443, serverPort: 35729, sniPort: 44301, url: 'https://safebrowsing.googleapis.com:443' } +0ms
  cypress:network:connect successfully connected { opts: { port: '443', host: 'safebrowsing.googleapis.com', getDelayMsForRetry: [Function: getDelayForRetry] }, iteration: 0 } +4m
  cypress:https-proxy received upstreamSocket callback for request { port: '443', hostname: 'safebrowsing.googleapis.com', err: undefined } +28ms

and then Cypress just does nothing and hangs until the CI kills it

Maybe this is more helpful:

  cypress:https-proxy received error on client browserSocket { err: Error: read ECONNRESET     at TCP.onStreamRead (internal/stream_base_commons.js:183:27) { errno: 'ECONNRESET', code: 'ECONNRESET', syscall: 'read' }, url: 'XXXX:443' } +37ms
  cypress:proxy:http:request-middleware request aborted +56ms
  cypress:server:request aborting { requestId: 'request85' } +35ms

Also this when trying to run with NO_PROXY:

cypress:proxy:http:request-middleware request aborted +25ms
  cypress:server:request aborting { requestId: 'request148' } +10ms
  cypress:https-proxy received error on client browserSocket { err: Error: write EPIPE     at afterWriteDispatched (internal/stream_base_commons.js:146:25)     at writeGeneric (internal/stream_base_commons.js:137:3)     at Socket._writeGeneric (net.js:698:11)     at Socket._write (net.js:710:8)     at doWrite (_stream_writable.js:418:12)     at writeOrBuffer (_stream_writable.js:402:5)     at Socket.Writable.write (_stream_writable.js:302:11)     at Socket.ondata (_stream_readable.js:720:22)     at Socket.emit (events.js:203:13)     at addChunk (_stream_readable.js:295:12)     at readableAddChunk (_stream_readable.js:276:11)     at Socket.Readable.push (_stream_readable.js:210:10)     at TCP.onStreamRead (internal/stream_base_commons.js:166:17) { errno: 'EPIPE', code: 'EPIPE', syscall: 'write' }, url: 'XXX:443' } +27ms

The automation client disconnected. Cannot continue running tests.


In my case the real error is above that. That seems to be a internal call that Chrome makes on its own
On 18 Mar 2020, 12:11 +0000, Marcin Wolniewicz notifications@github.com, wrote:

I can see something like this:
cypress:server:server Got CONNECT request from safebrowsing.googleapis.com:443 +4m

cypress:https-proxy Writing browserSocket connection headers { url: 'safebrowsing.googleapis.com:443', headLength: 0, headers: { host: 'safebrowsing.googleapis.com:443', 'proxy-connection': 'keep-alive', 'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/79.0.3945.79 Chrome/79.0.3945.79 Safari/537.36' } } +4m

cypress:https-proxy Got first head bytes { url: 'safebrowsing.googleapis.com:443', head: '\u0016\u0003\u0001\u0002\u0000\u0001\u0000\u0001�\u0003\u00039�B.��\u000b�@��\u0001\u0006�\u001c\b$.\u0010ھ�\u0018I?aI@pu;� \u000b����6\u0017\u0004ZN�ߪ���w�6�Wq' } +1ms

cypress:network:cors Parsed URL { port: '443', tld: 'googleapis.com', domain: 'safebrowsing' } +4m

cypress:server:server HTTPS request does not match URL: https://safebrowsing.googleapis.com:443 with props: { port: '443', tld: 'com', domain: 'soundtrap' } +1ms

cypress:https-proxy Making connection to safebrowsing.googleapis.com:443 +0ms

cypress:https-proxy getting proxy URL { port: 443, serverPort: 35729, sniPort: 44301, url: 'https://safebrowsing.googleapis.com:443' } +0ms

cypress:network:connect successfully connected { opts: { port: '443', host: 'safebrowsing.googleapis.com', getDelayMsForRetry: [Function: getDelayForRetry] }, iteration: 0 } +4m

cypress:https-proxy received upstreamSocket callback for request { port: '443', hostname: 'safebrowsing.googleapis.com', err: undefined } +28ms

and then Cypress just does nothing and hangs until the CI kills it
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Not exactly related but a lot of people are having the same issue.
https://github.com/cypress-io/cypress/issues/6449

Yes our tests on Cypress also hang on Github Actions

we faced the same nasty bug and we managed to solve it by adding shm_size: 2GB to the cypress service inside the docker composer but If u are using docker run ... instead of docker-composer then u can do something like docker run --shm_size=2GB .....

@0xIslamTaha Do you have an idea of how we can configure this option on github actions? :)

@0xIslamTaha Do you have an idea of how we can configure this option on github actions? :)

@sebfie, could u share your github action file? If u are using docker-compose or executing docker run directly then it should be easy to configure it

Here is my github action file :

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Example-Fo CI

on: [push]

jobs:
  test:
    runs-on: ubuntu-16.04
    container: cypress/browsers:node12.14.0-chrome79-ff71
    env:
      PORT: 3000
      API_URL: https://example.com/api/v1
      ASSETS_URL: https://example.com
      CLOUDINARY_NAME: example
      HOSTNAME: http://localhost:3000
      MAPBOX_TOKEN: ${{ secrets.MAPBOX_TOKEN_STAGING }}
      ES_HOST: ${{ secrets.ES_HOST_STAGING }}
      ES_USER: ${{ secrets.ES_USER_STAGING }}
      ES_PASS: ${{ secrets.ES_PASS_STAGING }}
      DISABLE_PUSHER: true
      DISABLE_SENTRY: true
      SEO_NO_INDEX: true
      DEBUG: cypress:cli  
    steps:
      - name: Checkout
        uses: actions/checkout@v1

      - name: Cache yarn
        uses: actions/cache@v1
        with:
          path: ~/.cache/yarn
          key: ${{ runner.os }}-yarn-${{ hashFiles(format('{0}{1}', github.workspace, '/yarn.lock')) }}
          restore-keys: |
            ${{ runner.os }}-yarn-

      - name: Install dependencies
        run: yarn install

      - name: Build app
        run: yarn build

      - name: Unit tests
        run: yarn test

      - name: E2E tests
        timeout-minutes: 30
        uses: cypress-io/github-action@v1
        with:
          start: yarn start
          install: false
          browser: chrome
          config-file: cypress.json

      - name: Upload Screenshots
        uses: actions/upload-artifact@v1
        if: failure()
        with:
          name: screenshots
          path: cypress/screenshots

      - name: Upload Videos
        uses: actions/upload-artifact@v1
        if: failure()
        with:
          name: screenshots
          path: cypress/videos

add options: --shm-size 2gb and for more info check here

--shm-size 2gb

Trying this ! Thx

@0xIslamTaha It works, a so big thank you !

Adding shm_size: '2gb' to my docker compose file worked for me!

I don't have a reproducible codebase to offer, but here's a description and specs in case they are helpful:

I have two spec files. One always works. The other works when tests are ran individually (with .only), or in a small collection (by adding .skip to some), but not as a whole — until I added shm_size.

Node v12.14.1
npm 6.14.5
Yarn 1.22.4
CentOS Linux release 7.7.1908 (Core) — based on cypress/base:centos7-12.4.0
Firefox 60.3ESR

I confirm I encountered the same issue and shm_size did the trick.
But my question is: why does cypress require 2gb of shared memory?

Increasing the smh_size also worked for our team.

Please I have this problem of running it locally ... it hangs from time to time on headless mode with chrome ... any ideas ?

Also having this bug when running locally. Started recently when writing a new spec. It ran for 12s before getting stuck and is still stuck. No timeout or actions happen when running it on Runner. And when trying to run it using CL, title is stuck but nothing else happens.

I confirm I encountered the same issue and shm_size did the trick.
But my question is: why does cypress require 2gb of shared memory?

not cypress, its chrome

Setting shm_size did not work for me, and maybe someone here is wiser than me on why this is happening.

In my pipeline, Cypress hangs for ~2 minutes while executing the last test (I'm not sure whether being the last is meaningful):
https://github.com/photion/web-admin/runs/1200705923?check_suite_focus=true#step:7:287

Nothing special happens in the test. I have downloaded a video of the problem and Cypress literally hangs for 2 minutes, and then it executes the test (which actually takes ~1 second).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carloscheddar picture carloscheddar  Â·  3Comments

tahayk picture tahayk  Â·  3Comments

rbung picture rbung  Â·  3Comments

SecondFlight picture SecondFlight  Â·  3Comments

dkreft picture dkreft  Â·  3Comments