Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update after 13.6.3 runs in execution timeouts on CI/CD #29333

Closed
JohnnyDevNull opened this issue Apr 15, 2024 · 10 comments · Fixed by #29349
Closed

Update after 13.6.3 runs in execution timeouts on CI/CD #29333

JohnnyDevNull opened this issue Apr 15, 2024 · 10 comments · Fixed by #29349
Assignees

Comments

@JohnnyDevNull
Copy link

JohnnyDevNull commented Apr 15, 2024

Current behavior

When we're try to update cypress above 13.6.3 our CI/CD setup runs into 90 minutes Execution Timeout

All tests normally succeed within 60 minutes, since 13.6.4 we cannot upgrade cypress.

I've tried to identify changes in the changelog that could have been caused this issue, but can only make assumptions.

If I execute random suites locally with the Cypress Studio it seems like everything looks fine.

For me it looks like the ServiceWorker Changes caused the issue, because we're using an active ServiceWorker:

and the issue still exists with 13.7.3

Desired behavior

Cypress should run on CI/CD as before

Test code to reproduce

It's not possible to provide a working repo for reproduction because of restrictions and the size of the application.

Instead I try to describe as good as possible our setup.

Wher're using the docker factory image:

# For available versions and ARG's see: https://hub.docker.com/r/cypress/factory/

# Note: before changing the Node version check compatibility with mongosh: https://www.mongodb.com/docs/mongodb-shell/
ARG NODE_VERSION='18.19.1'
# Note: the version should match the last supported, run "cd apps/client; npx browserslist" before change
ARG CHROME_VERSION='120.0.6099.224-1'
# Note: The version has to match with the cypress version from package.json
ARG CYPRESS_VERSION='13.7.3'

FROM cypress/factory

RUN apt-get update
RUN apt-get install -y gnupg tzdata

ENV TZ=Europe/Berlin
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | apt-key add -
RUN echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-6.0.list
RUN apt-get update
RUN apt-get install -y curl
RUN apt-get install -y mongodb-mongosh
RUN apt-get install -y mongodb-org-tools

The tests are getting executed via nx e2e command (the client is build and shipped via extra step before running the tests):

        docker run \
        --network container:%SERVER_CONTAINER% \
        --entrypoint=./node_modules/.bin/nx \
        redcypress/e2e-client \
        e2e client-e2e-cypress \
        --dev-server-target= \
        --base-url=https://localhost:29000 \
        --browser chrome \

Cypress Version

13.6.3

Node version

18.19.1

Operating System

Unix > TeamCity

Debug Logs

No response

Other

No response

@jennifer-shehane
Copy link
Member

@JohnnyDevNull Are you recording to the Cypress Cloud? If so,

  • Could you provide a URL to a Cloud recording on 13.6.3 and one on 13.7.3?
  • If you update to 13.7.3 and disable Test Replay, do the timeouts stop?
  • Also any info on how you're registering or using the ServiceWorker might be helpful.

We're actively investigating these types of performance issues. This information will help us narrow down the use case.

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Apr 15, 2024
@jennifer-shehane
Copy link
Member

@JohnnyDevNull Oh! Also, could you run Cypress in debug mode mode and print the entire set of logs here?

@mschile
Copy link
Contributor

mschile commented Apr 15, 2024

@JohnnyDevNull, could you please try installing this pre-release binary to see if it helps with the timeouts:

npm install https://cdn.cypress.io/beta/npm/13.7.4/linux-x64/mschile/service_worker_uncontrolled-446d5ea752383bc68ac73b0a9a8fe87d0428be7d/cypress.tgz

@JohnnyDevNull
Copy link
Author

JohnnyDevNull commented Apr 16, 2024

@JohnnyDevNull Are you recording to the Cypress Cloud? If so,

  • Could you provide a URL to a Cloud recording on 13.6.3 and one on 13.7.3?
  • If you update to 13.7.3 and disable Test Replay, do the timeouts stop?
  • Also any info on how you're registering or using the ServiceWorker might be helpful.

We're actively investigating these types of performance issues. This information will help us narrow down the use case.

Hi @jennifer-shehane,

wer not using the Cypress Cloud, again because of restrictions. Our test are getting executed within our TeamCity and Docker environment, but here is how we are registering the ServiceWorker:

if ('serviceWorker' in navigator) {
  window.addEventListener('load',  () => {
    navigator.serviceWorker.register('/service-worker.js', {
      scope: '/'
    })
      .then(registration => {
        registration.update();
      })
      .catch((error) => {
        console.error(`Service worker registration failed with ${error}`);
      });
  });
}

The ServiceWorker ist used mainly for checking the app version which is saved to the IndexedDB

self.addEventListener('fetch', (event) => {
  if(!self.indexedDB) {
    return;
  }

  if (!appVersionDbInstance) {
    // Sometimes the database instance disappears and we need to set it again.
    return event.waitUntil(setDatabaseInstance());
  }

  if (!event.request.url.startsWith(self.location.origin)) {
    return;
  }

  return event.respondWith(
    getCurrentAppVersion()
      .then(function (currentAppVersion) {
        const modifiedHeaders = new Headers(event.request.headers);
        modifiedHeaders.set(RED_VERSION_HEADER, currentAppVersion || '');
        const modifiedRequest = new Request(event.request, { headers: modifiedHeaders, mode: 'same-origin' });
        return fetch(modifiedRequest);
      })
    .catch(error => logError(error)));
});

I hope this helps a little bit.

@JohnnyDevNull
Copy link
Author

@JohnnyDevNull Oh! Also, could you run Cypress in debug mode mode and print the entire set of logs here?

I'm going to try this out and come back with some feedback.

@JohnnyDevNull
Copy link
Author

@JohnnyDevNull, could you please try installing this pre-release binary to see if it helps with the timeouts:

npm install https://cdn.cypress.io/beta/npm/13.7.4/linux-x64/mschile/service_worker_uncontrolled-446d5ea752383bc68ac73b0a9a8fe87d0428be7d/cypress.tgz

I'm going to try this out and come back with some feedback.

@JohnnyDevNull
Copy link
Author

@JohnnyDevNull, could you please try installing this pre-release binary to see if it helps with the timeouts:

npm install https://cdn.cypress.io/beta/npm/13.7.4/linux-x64/mschile/service_worker_uncontrolled-446d5ea752383bc68ac73b0a9a8fe87d0428be7d/cypress.tgz

I'm going to try this out and come back with some feedback.

@mschile is there a way to integrate that into the factory docker image?
https://hub.docker.com/r/cypress/factory/

As I've described our CI/CD setup uses the factory image, so I need to run the tests on that specific pre-release right?

@JohnnyDevNull
Copy link
Author

JohnnyDevNull commented Apr 16, 2024

@JohnnyDevNull, could you please try installing this pre-release binary to see if it helps with the timeouts:

npm install https://cdn.cypress.io/beta/npm/13.7.4/linux-x64/mschile/service_worker_uncontrolled-446d5ea752383bc68ac73b0a9a8fe87d0428be7d/cypress.tgz

I'm going to try this out and come back with some feedback.

Hey @mschile it looks very promising. I've run a single file locally in headless mode:

Version 13.7.3
Bildschirmfoto 2024-04-16 um 14 42 20

Version 13.7.4
Bildschirmfoto 2024-04-16 um 14 42 28

@JohnnyDevNull
Copy link
Author

@JohnnyDevNull Oh! Also, could you run Cypress in debug mode mode and print the entire set of logs here?

I'm going to try this out and come back with some feedback.

Hey @jennifer-shehane,

I've activated locally for a single suite the DEBUG mode as following:

DEBUG=cypress:* npm run nx -- e2e client-e2e-cypress --dev-server-target= --spec=apps/client-e2e-cypress/src/e2e/administration/begruendungen.cy.ts --skip-nx-cache 2>&1 | aha --black | tee cypress-debug-run-1.html

But to be hones the logs are very much. Is there a specific log level which would be enough here? I mean for our specific use case?

I uploaded the logs to my google drive here: https://drive.google.com/drive/folders/1Q2msc40mnzDvS-eJWgfE7Kza9vMUfCpx?usp=sharing

Please request access and I'm going to open to you.

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 23, 2024

Released in 13.8.1.

This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v13.8.1, please open a new issue.

@cypress-bot cypress-bot bot removed the stage: needs information Not enough info to reproduce the issue label Apr 23, 2024
@cypress-bot cypress-bot bot locked as resolved and limited conversation to collaborators Apr 23, 2024
@mschile mschile self-assigned this Apr 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants