cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.87k stars 3.17k forks source link

Cypress hangs during execution of test suite #6695

Closed mariotsi closed 1 year ago

mariotsi commented 4 years ago

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

jennifer-shehane commented 4 years ago

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.

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.

mariotsi commented 4 years ago

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' }```
greglds commented 4 years ago

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

mariotsi commented 4 years ago

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: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

wytrych commented 4 years ago

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?

wytrych commented 4 years ago

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.
mariotsi commented 4 years ago

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.

vivek12345 commented 4 years ago

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

sebfie commented 4 years ago

Yes our tests on Cypress also hang on Github Actions

0xIslamTaha commented 4 years ago

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 .....

sebfie commented 4 years ago

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

0xIslamTaha commented 4 years ago

@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

sebfie commented 4 years ago

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
0xIslamTaha commented 4 years ago

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

sebfie commented 4 years ago

--shm-size 2gb

Trying this ! Thx

sebfie commented 4 years ago

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

chris-canipe commented 4 years ago

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

Songyu-Wang commented 4 years ago

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?

droca commented 4 years ago

Increasing the smh_size also worked for our team.

Cubo25 commented 4 years ago

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

tihmatsumoto commented 4 years ago

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.

0xIslamTaha commented 4 years ago

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

dipasqualew commented 4 years ago

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).

0xIslamTaha commented 3 years ago

It hangs right now in my setup, as one of my spic takes arround 15 mins 😭😭. This is really annoying bug.

Paychokxxx commented 3 years ago

also hang in my local setup

bahunov commented 3 years ago

It hangs right now in my setup, as one of my spic takes arround 15 mins 😭😭. This is really annoying bug.

I used to see this hang and my solution was:

  1. Active garbage collection in chrome afterEach()
  2. Use numTestKeptInMem to 0
  3. Don't run too long test cases in one spec/it-scope. Test's need to be atomic/small/fast in general anyways..
premkumar-gg commented 3 years ago

Is it possible to set the shm_size when running cypress using the cli cypress open?

0xIslamTaha commented 3 years ago

Is it possible to set the shm_size when running cypress using the cli cypress open?

@premkumar-gg cypress open should be ahead mode process which gonna use the system memory

bugzpodder commented 3 years ago

i fixed the issue by turning off video recording.

dclowd9901 commented 3 years ago

i fixed the issue by turning off video recording.

I, too, have reason to believe that this hanging issue is being caused by video records.

I was able to actually get the event to occur on my local machine. What happened, I found, is that the stall happens after the "afterEach" event, but before the "after" event. A screen shot was taken of the failure, which looked like this:

test failure

Here was the logged output:

  Running:  path/to/file.spec.js                                (5 of 43)
[cypress-log-to-output] Warning: An unsupported browser family was used, output will not be logged to console: chromium
[Mon Jun 14 2021 11:06:41 GMT-0700 (Pacific Daylight Time)]---test "before"---
[Mon Jun 14 2021 11:06:41 GMT-0700 (Pacific Daylight Time)]---attempt getCachedAccount---
[Mon Jun 14 2021 11:06:41 GMT-0700 (Pacific Daylight Time)]---getCachedAccount.then---
[Mon Jun 14 2021 11:06:41 GMT-0700 (Pacific Daylight Time)]---cached account found, cy.logIn...---
[Mon Jun 14 2021 11:06:42 GMT-0700 (Pacific Daylight Time)]---cy.logIn.then---
[Mon Jun 14 2021 11:06:42 GMT-0700 (Pacific Daylight Time)]---Resolving cy.logIn...---
[Mon Jun 14 2021 11:06:42 GMT-0700 (Pacific Daylight Time)]---login resolved successfully---
  <TEST NAME REDCACTED>
[Mon Jun 14 2021 11:06:43 GMT-0700 (Pacific Daylight Time)]---test "beforeEach"---
    (Attempt 1 of 3) has the attachement warning
[Mon Jun 14 2021 11:06:43 GMT-0700 (Pacific Daylight Time)]---test "afterEach"---

I tried to view the video, but found that it was corrupt. This leads me to believe the failure happened in the middle of video encoding.

Update: After running many many times with video saving turned off, I've run into no more failures like this. I'm pretty sure video processing is the problem here. I'm also inclined to believe it's due to the length of the videos being processed. Our tests run much longer than I think the normal cypress tests run.

akauppi commented 3 years ago

EDIT:

Got solved by closing and restarting Docker. Not a systematic thing - not reproducible (any more).


Experiencing this on Docker Compose, locally.

Either Electron or Chrome browsers - do difference.

Symptoms:

Exactly as described by the original author.

Tests don't seem to start. No errors about it.

Since this is an open source project, I can provide the steps to reproduce. Just ask.

Work-arounds?

Have tried the shm_size: 2GB setting. Doesn't change anything.


Service in docker-compose.yml:

  cypress:
    image: cypress/included:8.3.0
    volumes:
      - .:/work
    working_dir: /work
    command: [
      '--headless',
      '--browser', 'chrome'
    ]
    shm_size: 2GB
      # ^-- doesn't cure the problem
    environment:
      - CYPRESS_BASE_URL=http://vite:3000
      #- DEBUG=cypress:*
    depends_on: ['vite']
    profiles: ['manual']
TeemuKoivisto commented 2 years ago

In my case the hanging was caused by the tests being left as "pending". Interrupting them instead fixed it using this great hack on SO.

Vamsi-K-Reddy commented 2 years ago

In my case, cypress hangs while inputting special characters- special char string-->"{SubmittedAbcdefName}_{LIST: monpqrx abcdef#one,monpqrx_abcdef - @two}"

cy.get().clear().type(, { parseSpecialCharSequences: false })

Please note- We have only one 'it' block and approx. 100 lines of code.

martincarstens commented 2 years ago

Reposting our solution for visibility: https://github.com/cypress-io/cypress/issues/8206#issuecomment-1086950214

stuart-clark commented 2 years ago

Reposting our solution for visibility: https://github.com/cypress-io/cypress/issues/8206#issuecomment-1099738769

patrick-silvera-pp commented 2 years ago

Same issue has described by OP. I'm running a 75 specs test suite on 20 parallel machines.

Github Actions
Docker image cypress/browsers:node16.13.2-chrome100-ff98
cypress 9.5.4
cypress-cucumber-preprocessor 9.0.5

While i'm writing this, 5 runs out the 7 last runs are hanging in Cypress dashboard. This is costing quite a lot of CI money, even with a timeout set in Github Actions. I tried this without success:

This is random, I wish I could give you more info to address this issue. Is there any other way we could help? This has been a problem for a lot of people for 2 years now.

patrick-silvera-pp commented 2 years ago

It turns out all our tests were hanging on our login page. After removing recaptcha entirely from the page I didn't get any more freezes (at least not yet, but i just ran 45 runs without any issue). This is not ideal since we would like to have our test environments as close to production as possible, with recaptcha using a dev/test key, but for now I guess we will just remove recaptcha from our test environments.

I'm also having similar issues with sentry.io requests stuck trying to resolve even if I blocked it in cypress.json with blockHosts. But I could workaround this using a hand-made timeout

let timer = setTimeout(function () {
  timer = null
  throw new Error(message)
}, milliseconds)
...
cy.some_action().then(() => {
    clearTimeout(timer)
}

This workaround does not work with recaptcha that's why we had to remove recaptcha.

Hope this helps anyone with the same issue.

jennifer-shehane commented 1 year ago

Since this issue hasn't had activity in a while, we'll close the issue until we can confirm this is still happening and the reasons why this has been happening. There's a LOT of things that could cause hanging and we can focus on issues that give clear reproducible examples of hanging. It's clear from this thread that there are various contributing factors that may or may not have been solved over the years.

If you experience hanging within Cypress, please open a new issue with details for us to reproduce the issue and include DEBUG logs.