cypress-io / cypress-docker-images

Docker images with Cypress dependencies and browsers

Home Page:https://on.cypress.io/continuous-integration

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Xvfb error on GitHub CI: (EE) Server is already active for display 99

dwightjack opened this issue · comments

Hello! I am using the cypress/base:18.12.1 container image to run a GitHub Action job that executes 4 instances of Cypress in parallel. Here is a sample of the job:

test:
  name: tests
  runs-on: [self-hosted, dev, standard]
  container: cypress/base:18.12.1
  steps:
    # ...
    - name: Component testing
      run: pnpm turbo run cypress run --component

The turbo CLI tool runs the cypress run --component on multiple targets in parallel.

This was working fine for the last 4 months then, without any change in the setup, the job started randomly failing on some branches with the following error:

> cypress run --component
  
  [STARTED] Task without title.
  [FAILED] Xvfb exited with a non zero exit code.
  [FAILED] 
  [FAILED] There was a problem spawning Xvfb.
  [FAILED] 
  [FAILED] This is likely a problem with your system, permissions, or installation of Xvfb.
  [FAILED] 
  [FAILED] ----------
  [FAILED] 
  [FAILED] Error: (EE) 
  [FAILED] Fatal server error:
  [FAILED] (EE) Server is already active for display 99
  [FAILED] If this server is no longer running, remove /tmp/.X99-lock
  [FAILED] and start again.
  [FAILED] (EE)
  [FAILED] 
  [FAILED] ----------
  [FAILED] 
  [FAILED] Platform: linux-x64 (Debian - 11.5)
  [FAILED] Cypress Version: 12.17.4
  Xvfb exited with a non zero exit code.
  
  There was a problem spawning Xvfb.
  
  This is likely a problem with your system, permissions, or installation of Xvfb.

I don't think this is an issue with Cypress itself, so I am wondering if this is some issue related to the container I am using.

Thanks in advance!

@dwightjack

This is probably not an issue with Cypress or with the Cypress Docker image cypress/base:18.12.1 and I haven't seen any related reports concerning this error running on GitHub CI.

It looks like you are running on a GitHub self-hosted runner. You might like to try running on a GitHub-hosted runner just as a test to see if it is related to your self-hosted runners.

The Cypress way of running tests in parallel containers in GitHub is to use the Cypress Cloud - see https://docs.cypress.io/guides/cloud/smart-orchestration/parallelization. You should not run into Xvfb issues if you use this because as far as GitHub is concerned, each of the containers runs separately from each other.

The Cypress GitHub Action supports this. See https://github.com/cypress-io/github-action#parallel.

I don't know the turbo tool, so I can't give you any feedback on that. You could try asking in the Cypress technical community on Discord

Discord chat (click on button)

if anybody else has experience with this tool.

@MikeMcC399 Thanks for the quick reply. I guess that it might be the GH runner then. I'll try your suggestion and, if the job is still not working, I will ask in the Discord community.

Thanks again!