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

Error: Could not start Xvfb. Install XVFB and run Cypress again. #5110

Closed
davidcelis opened this issue Apr 9, 2018 · 51 comments · Fixed by #5114
Closed

Error: Could not start Xvfb. Install XVFB and run Cypress again. #5110

davidcelis opened this issue Apr 9, 2018 · 51 comments · Fixed by #5114
Assignees
Labels

Comments

@davidcelis
Copy link

davidcelis commented Apr 9, 2018

Hi, folks! I'm using Cypress to run an end-to-end testing suite against an application I work on. I've been running into a really weird issue with the docker images, one which only seems to happen on our CI (TeamCity); I haven't been able to reproduce it locally.

Running cypress verify in the Docker image ends up failing and saying that Xvfb is not installed, even though it's listed in the Dockerfile as a dependency to be installed. Simply restarting a build is enough to get the Docker setup back into the right state, and then the tests can run just fine. Here is a log of pulling and starting the Cypress docker image; between failing and passing builds, nothing changes. The same image sha ends up being pulled but sometimes fails to detect Xvfb.

[09:07:49]	[Step 3/11] Temporary file was created: /opt/teamcity-agent/work/5c5a013f643109a5/Dockerfile_TC_1523290069059-temp
[09:07:49]	[Step 3/11] Starting: docker build -t SCRUBBED --pull --label "branch=refs/heads/master" --label "commit=SCRUBBED" -f /opt/teamcity-agent/work/5c5a013f643109a5/Dockerfile_TC_1523290069059-temp .
[09:07:49]	[Step 3/11] in directory: /opt/teamcity-agent/work/5c5a013f643109a5
[09:07:49]	[Step 3/11] 
[09:07:49]	[Step 3/11] Step 1/6 : FROM cypress/base:8
[09:07:50]	[Step 3/11] 8: Pulling from cypress/base
[09:07:50]	[Step 3/11] f2b6b4884fc8: Already exists
[09:07:50]	[Step 3/11] 4fb899b4df21: Already exists
[09:07:50]	[Step 3/11] 74eaa8be7221: Already exists
[09:07:51]	[Step 3/11] 2d6e98fe4040: Already exists
[09:07:51]	[Step 3/11] 452c06dec5fa: Pulling fs layer
[09:07:51]	[Step 3/11] 7b3c215894de: Pulling fs layer
[09:07:51]	[Step 3/11] c62e8e1f22ef: Pulling fs layer
[09:07:51]	[Step 3/11] 93263a0b6217: Pulling fs layer
[09:07:51]	[Step 3/11] 344085b70f46: Pulling fs layer
[09:07:51]	[Step 3/11] f18709ef8150: Pulling fs layer
[09:07:51]	[Step 3/11] 16b62243dd9a: Pulling fs layer
[09:07:51]	[Step 3/11] f18709ef8150: Waiting
[09:07:51]	[Step 3/11] 344085b70f46: Waiting
[09:07:51]	[Step 3/11] 16b62243dd9a: Waiting
[09:07:51]	[Step 3/11] 93263a0b6217: Waiting
[09:07:51]	[Step 3/11] 452c06dec5fa: Verifying Checksum
[09:07:51]	[Step 3/11] 7b3c215894de: Download complete
[09:07:51]	[Step 3/11] 452c06dec5fa: Pull complete
[09:07:51]	[Step 3/11] 7b3c215894de: Pull complete
[09:07:51]	[Step 3/11] c62e8e1f22ef: Verifying Checksum
[09:07:51]	[Step 3/11] c62e8e1f22ef: Download complete
[09:07:51]	[Step 3/11] 93263a0b6217: Verifying Checksum
[09:07:51]	[Step 3/11] 93263a0b6217: Download complete
[09:07:52]	[Step 3/11] 16b62243dd9a: Verifying Checksum
[09:07:52]	[Step 3/11] 16b62243dd9a: Download complete
[09:07:52]	[Step 3/11] f18709ef8150: Verifying Checksum
[09:07:53]	[Step 3/11] c62e8e1f22ef: Pull complete
[09:07:53]	[Step 3/11] 344085b70f46: Verifying Checksum
[09:07:53]	[Step 3/11] 344085b70f46: Download complete
[09:07:53]	[Step 3/11] 93263a0b6217: Pull complete
[09:07:57]	[Step 3/11] 344085b70f46: Pull complete
[09:07:58]	[Step 3/11] f18709ef8150: Pull complete
[09:07:58]	[Step 3/11] 16b62243dd9a: Pull complete
[09:07:58]	[Step 3/11] Digest: sha256:d82d1db790e5a585b1db2e0f8fe3ff343d981ba18db477e40a0b498e04c73e23
[09:07:58]	[Step 3/11] Status: Downloaded newer image for cypress/base:8
[09:07:58]	[Step 3/11]  ---> ed9c4e411f39
[09:07:58]	[Step 3/11] Step 2/6 : ADD integration-tests /src/integration-tests
[09:07:59]	[Step 3/11]  ---> 14d57ea2af4d
[09:07:59]	[Step 3/11] Removing intermediate container 66e0363b40eb
[09:07:59]	[Step 3/11] Step 3/6 : WORKDIR /src/integration-tests
[09:07:59]	[Step 3/11]  ---> 3071a36c58b5
[09:07:59]	[Step 3/11] Removing intermediate container 478a01054b29
[09:07:59]	[Step 3/11] Step 4/6 : RUN yarn install
[09:07:59]	[Step 3/11]  ---> Running in e9ca1a3678ff
[09:08:05]	[Step 3/11] yarn install v1.5.1
[09:08:05]	[Step 3/11] [1/4] Resolving packages...
[09:08:06]	[Step 3/11] [2/4] Fetching packages...
[09:08:10]	[Step 3/11] [3/4] Linking dependencies...
[09:08:12]	[Step 3/11] [4/4] Building fresh packages...
[09:08:52]	[Step 3/11] Done in 46.50s.
[09:09:00]	[Step 3/11]  ---> b8cb0306c75a
[09:09:03]	[Step 3/11] Removing intermediate container e9ca1a3678ff
[09:09:03]	[Step 3/11] Step 5/6 : RUN $( yarn bin )/cypress verify
[09:09:03]	[Step 3/11]  ---> Running in 109a9fd4ae07
[09:09:04]	[Step 3/11] It looks like this is your first time using Cypress: 2.1.0
[09:09:04]	[Step 3/11] 
[09:09:04]	[Step 3/11] [16:09:04]  Verifying Cypress can run /src/integration-tests/node_modules/cypress/dist/Cypress [started]
[09:09:06]	[Step 3/11] [16:09:06]  Verifying Cypress can run /src/integration-tests/node_modules/cypress/dist/Cypress [failed]
[09:09:06]	[Step 3/11] [16:09:06] → Your system is missing the dependency: XVFB
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Install XVFB and run Cypress again.
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Read our documentation on dependencies for more information:
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] https://on.cypress.io/required-dependencies
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] If you are using Docker, we provide containers with all required dependencies installed.
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Caught error trying to run XVFB: "Your system is missing the dependency: XVFB
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Install XVFB and run Cypress again.
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Read our documentation on dependencies for more information:
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] https://on.cypress.io/required-dependencies
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] If you are using Docker, we provide containers with all required dependencies installed.
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Error: Could not start Xvfb.
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Platform: linux (Debian - 8.10)
[09:09:06]	[Step 3/11] Cypress Version: 2.1.0"
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Platform: linux (Debian - 8.10)
[09:09:06]	[Step 3/11] Cypress Version: 2.1.0
[09:09:06]	[Step 3/11] Your system is missing the dependency: XVFB
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Install XVFB and run Cypress again.
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Read our documentation on dependencies for more information:
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] https://on.cypress.io/required-dependencies
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] If you are using Docker, we provide containers with all required dependencies installed.
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Caught error trying to run XVFB: "Your system is missing the dependency: XVFB
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Install XVFB and run Cypress again.
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Read our documentation on dependencies for more information:
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] https://on.cypress.io/required-dependencies
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] If you are using Docker, we provide containers with all required dependencies installed.
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Error: Could not start Xvfb.
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Platform: linux (Debian - 8.10)
[09:09:06]	[Step 3/11] Cypress Version: 2.1.0"
[09:09:06]	[Step 3/11] ----------
[09:09:06]	[Step 3/11] 
[09:09:06]	[Step 3/11] Platform: linux (Debian - 8.10)
[09:09:06]	[Step 3/11] Cypress Version: 2.1.0
[09:09:07]	[Step 3/11] The command '/bin/sh -c $( yarn bin )/cypress verify' returned a non-zero code: 1
[09:09:07]	[Step 3/11] The command '/bin/sh -c $( yarn bin )/cypress verify' returned a non-zero code: 1
[09:09:07]	[Step 3/11]
[09:09:07]	[Step 3/11] Process exited with code 1
[09:09:07]	[Step 3/11] Process exited with code 1
[09:09:07]	[Step 3/11] Step   ‍♀️ build integration-tests docker image (Docker Build) failed
@bahmutov
Copy link
Contributor

bahmutov commented Apr 9, 2018

Interesting, and we see this randomly on TravisCI when using Docker - XVFB not being detected, but restarting the build solves it. I wonder if increasing the timeout when passed as an option to https://github.com/cypress-io/xvfb/blob/master/index.js would solve this problem. This is so transient that we did not look into this, but seems different CIs can encounter it

@flegall
Copy link

flegall commented Apr 18, 2018

I've also reproduced this issue on gitlab-ci.

@davidcelis
Copy link
Author

It's been happening more and more frequently for us as time goes on; nearly one in five of our builds fail because Xvfb doesn't start in the container. Have you tried the timeout increase yet with any success?

@avevlad
Copy link

avevlad commented Apr 18, 2018

in docker

�[0m
  (Tests Finished)

  - Tests:           1
  - Passes:          1
  - Failures:        0
  - Pending:         0
  - Duration:        4 seconds
  - Screenshots:     1
  - Video Recorded:  false
  - Cypress Version: 2.1.0


  (Screenshots)

  - /www/qw/cypress/screenshots/Simple test -- Login -- go to login.png (1280x720)
�[91mWed, 18 Apr 2018 22:41:11 GMT cypress:server:headless attempting to close the browser
�[0m�[91mWed, 18 Apr 2018 22:41:11 GMT cypress:server:browsers killing browser process
�[0m�[91mWed, 18 Apr 2018 22:41:35 GMT cypress:server:timers child sending timer id 3
�[0m�[91mWed, 18 Apr 2018 22:41:37 GMT cypress:server:timers child sending timer id 20
�[0m�[91mWed, 18 Apr 2018 22:41:37 GMT cypress:server:timers child sending timer id 21
�[0m�[91mWed, 18 Apr 2018 22:41:37 GMT cypress:server:timers child sending timer id 23
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 35
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 36
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 37
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 38
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 39
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 40
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 41
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 42
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 43
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 44
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 45
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 46
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 47
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 48
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 49
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 50
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 51
�[0m�[91mWed, 18 Apr 2018 22:41:38 GMT cypress:server:timers child sending timer id 52
�[0m�[91mWed, 18 Apr 2018 22:41:39 GMT cypress:server:timers child sending timer id 53
�[0m�[91mWed, 18 Apr 2018 22:41:39 GMT cypress:server:timers child sending timer id 54
�[0m�[91mWed, 18 Apr 2018 22:41:40 GMT cypress:server:timers child sending timer id 55
�[0m�[91mWed, 18 Apr 2018 22:41:40 GMT cypress:server:timers child sending timer id 56
�[0m�[91mWed, 18 Apr 2018 22:41:40 GMT cypress:server:timers child sending timer id 57
�[0m�[91mWed, 18 Apr 2018 22:41:40 GMT cypress:server:timers child sending timer id 58
�[0m�[91mWed, 18 Apr 2018 22:41:40 GMT cypress:server:timers child sending timer id 59
�[0m�[91mWed, 18 Apr 2018 22:41:40 GMT cypress:server:timers child sending timer id 60
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 64
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 65
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 66
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 67
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 68
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 69
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 70
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 71
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 72
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 73
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 74
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 75
Wed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 76
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 77
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 78
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 79
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 80
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 82
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 83
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 84
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 85
�[0m�[91mWed, 18 Apr 2018 22:41:41 GMT cypress:server:timers child sending timer id 86
�[0m�[91mWed, 18 Apr 2018 22:42:31 GMT cypress:server:timers child sending timer id 5
�[0m�[91mWed, 18 Apr 2018 22:42:31 GMT cypress:server:timers child sending timer id 6
�[0m�[91mWed, 18 Apr 2018 22:42:31 GMT cypress:server:timers child sending timer id 7
�[0m�[91mWed, 18 Apr 2018 22:42:31 GMT cypress:server:timers child sending timer id 9
�[0m�[91mWed, 18 Apr 2018 22:42:31 GMT cypress:server:timers child sending timer id 10
�[0m�[91mWed, 18 Apr 2018 22:42:31 GMT cypress:server:timers child sending timer id 11
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 12
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 13
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 14
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 15
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 16
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 17
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 18
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 19
�[0m�[91mWed, 18 Apr 2018 22:42:32 GMT cypress:server:timers child sending timer id 22
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 24
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 25
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 26
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 28
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 29
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 30
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 31
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 32
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 33
�[0m�[91mWed, 18 Apr 2018 22:42:33 GMT cypress:server:timers child sending timer id 34
�[0m�[91mWed, 18 Apr 2018 22:42:35 GMT cypress:server:timers child sending timer id 61
�[0m�[91mWed, 18 Apr 2018 22:42:35 GMT cypress:server:timers child sending timer id 62
�[0m�[91mWed, 18 Apr 2018 22:42:35 GMT cypress:server:timers child sending timer id 63
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 81
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 87
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 88
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 89
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 90
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 91
�[0m�[91mWed, 18 Apr 2018 22:42:36 GMT cypress:server:timers child sending timer id 92
�[0m�[91m2018-04-18T22:42:36.939Z cypress:cli Stopping XVFB
�[0m2018-04-18T22:42:36.951Z
result simple {
  "failures": null,
  "message": "Could not find Cypress test run results"
}

@bahmutov
Copy link
Contributor

bahmutov commented Apr 18, 2018 via email

@davidcelis
Copy link
Author

@avevlad Sorry, but that seems unrelated to the problem reported in this issue, which is Xvfb failing to start in the first place when using the docker image.

@davidcelis
Copy link
Author

Sorry to bug you again, but these Xvfb errors are becoming even more frequent on our CI… Have you tried the timeout increase yet with any success?

@bahmutov
Copy link
Contributor

bahmutov commented Apr 27, 2018 via email

@blalor
Copy link

blalor commented May 31, 2018

@bahmutov looks like 3.0.0 has been released. Did this fix make it in? Can you link the relevant commit here, please?

@davidcelis
Copy link
Author

would also love to know if the fix for this made it into 3.0.0. thanks!

@brian-mann
Copy link
Member

It did actually - it was not correctly set to a milestone so it was missed when doing the changelog.

It was bumped up to 5 seconds... but now that I think about it, I have no idea why we wouldn't set it to something like 30 seconds. I have seen situations where builds fail due to shutting off xvfb or starting it up.

timeout: 5000, // milliseconds

@sharitonchik
Copy link

We also see some times when tests fails with "Could not start Xvfb".
Cypress 3.0.2

@guigonc
Copy link

guigonc commented Aug 20, 2018

We have the same problem on version 3.1.0

@gcyu
Copy link

gcyu commented Oct 21, 2018

Last time I met this issue, the root cause is that the "Xvfb" process is already running, and cypress can not start it with errors like:

It looks like this is your first time using Cypress: 3.1.0

 ✖  Verifying Cypress can run /home/mi/.cache/Cypress/3.1.0/Cypress
   → Cypress Version: 3.1.0
Your system is missing the dependency: XVFB

Install XVFB and run Cypress again.

Read our documentation on dependencies for more information:

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.
----------

Caught error trying to run XVFB: "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.
----------

Error: _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
_XSERVTransMakeAllCOTSServerListeners: server already running
(EE)
Fatal server error:
(EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
----------

Platform: linux (Red Hat Linux - 7.4)
Cypress Version: 3.1.0"
----------

Platform: linux (Red Hat Linux - 7.4)
Cypress Version: 3.1.0

Then I checked that there're really some running processes of Xvfb in system,

ps -ef | grep Xvfb

and after I killed them everything went well.

ps -ef | grep Xvfb | grep -v grep | awk '{print $2}' | xargs kill -9

So in my case, this is not a problem with Cypress. Hope it helps.

@muslim-niche
Copy link

@yuguangchuan

ps -ef | grep Xvfb | grep -v grep | awk '{print $2}' | xargs kill -9

it worked for me. :)

@mel1nn
Copy link

mel1nn commented Feb 1, 2019

I had the same problem.

To resolve it, I installed xvfb: sudo apt-get install xvfb.

After that, I had an other problem which tells me that libgconf-2.so.4 cannot be loaded.
-> apt-get install libgconf-2-4

And it works !

@davidcelis
Copy link
Author

@mel1nn Unfortunately, that's not really a solution to this issue. Please note that this repository is for the Cypress docker images, which already list xvfb and libgconf-2-4 as dependencies.

@VincentLanglet
Copy link

I use the last Cypress version and I stil have randomly this error.

@leorigon
Copy link

We has this same problem with Jenkins. Someone fixed it?

@LeBenLeBen
Copy link

Landing here with the same error on Gitlab CI. When I use cypress/base:10 and use Electron, it works fine. If I switch to cypress/browsers:chrome67 or cypress/browsers:chrome69 and run Cypress with browser set to Chrome, I get the error above all the time.

@Junaid-Aslam1
Copy link

I am running into the same issue on bamboo CI. It happens intermittently.

@gcirone
Copy link

gcirone commented May 6, 2019

It's happens when another plan/process is executing in the same time as bamboo ci use a docker image with network=host. This is a pain we need to find a correct solution for this problem.

Error: XVFB exited with a non zero exit code.
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 There was a problem spawning Xvfb.
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 This is likely a problem with your system, permissions, or installation of Xvfb.
error 06-May-2019 05:20:38 ----------
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 Error: _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
error 06-May-2019 05:20:38 _XSERVTransMakeAllCOTSServerListeners: server already running
error 06-May-2019 05:20:38 (EE)
error 06-May-2019 05:20:38 Fatal server error:
error 06-May-2019 05:20:38 (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
error 06-May-2019 05:20:38 ----------
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 Platform: linux (Centos - 7.4.1708)
error 06-May-2019 05:20:38 Cypress Version: 3.1.4
error 06-May-2019 05:20:38 Error: Error: XVFB exited with a non zero exit code.
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 There was a problem spawning Xvfb.
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 This is likely a problem with your system, permissions, or installation of Xvfb.
error 06-May-2019 05:20:38 ----------
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 Error: _XSERVTransSocketINETCreateListener: ...SocketCreateListener() failed
error 06-May-2019 05:20:38 _XSERVTransMakeAllCOTSServerListeners: server already running
error 06-May-2019 05:20:38 (EE)
error 06-May-2019 05:20:38 Fatal server error:
error 06-May-2019 05:20:38 (EE) Cannot establish any listening sockets - Make sure an X server isn't already running(EE)
error 06-May-2019 05:20:38 ----------
error 06-May-2019 05:20:38
error 06-May-2019 05:20:38 Platform: linux (Centos - 7.4.1708)
error 06-May-2019 05:20:38 Cypress Version: 3.1.4`

Someone could confirm is because the network mode host?

@davidcelis
Copy link
Author

@gcirone We've never run the Cypress docker image with host mode networking, so I don't think that's related to the originally reported problem

@gcirone
Copy link

gcirone commented May 16, 2019

@davidcelis something block the second process is the first for any reason take more time or get freeze on some test.

The error message is quite explicative:
_XSERVTransMakeAllCOTSServerListeners: server already running

My question is: If the network mode is host the Xvfb process is shared between builds?

@davidcelis
Copy link
Author

@gcirone Maybe? But as I said, we don't run our image with host networking, so my originally reported Could not start Xvfb is unlikely to be related to host networking at all.

@gcirone
Copy link

gcirone commented May 17, 2019

Yes true @davidcelis I'll raise a new issue specific to my problem :)

@drewbrend
Copy link

We hadn't seen this error since upgrading to 3.0.0 until today. We saw it once in CI - nothing has changed with our docker container so this is definitely the timeout issue.

Brian mentions here that there's no reason this timeout couldn't be extended to 30 seconds, can that be prioritized? https://github.com/cypress-io/cypress-docker-images/issues/39#issuecomment-395606998

@brian-mann
Copy link
Member

There's a bunch of new logic in 3.3.1 for handling Xvfb - if DISPLAY is already set we attempt to use that x-server - and if that fails we then attempt to spawn Xvfb.

Not sure if that'll help these issues at all.

@grimunit
Copy link

Anyone tried out version 3.3.1 to see if this issue is still happening?

@obartra
Copy link
Contributor

obartra commented Jun 30, 2019

I still repro on 3.3.2

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Sep 10, 2019

The code for this is done in cypress-io/cypress#5114, but has yet to be released.
We'll update this issue and reference the changelog when it's released.

@cypress-bot cypress-bot bot removed the stage: needs review The PR code is done & tested, needs review label Sep 10, 2019
@pdcl09
Copy link

pdcl09 commented Sep 20, 2019

@bahmutov : when do you anticipate to release these changes?

@bahmutov
Copy link
Contributor

We will try to release it this month, meanwhile, it is possible to patch Cypress NPM module yourself, see how https://docs.cypress.io/guides/guides/debugging.html#Patch-Cypress

@pdcl09
Copy link

pdcl09 commented Sep 20, 2019

@bahmutov : can this patch be implemented for 3.4.0 version as well? I dont want to bump up the version to 3.4.1 as our docker image is set to use 3.4.0. Any suggestions would be helpful. Thanks

@bahmutov
Copy link
Contributor

@pdcl09 we will not backport any patches, but you can take v3.4.0 and create a patch yourself as our documentation describes - it is only changing a single constant there.

@pdcl09
Copy link

pdcl09 commented Sep 20, 2019

Perfect, that helps. Thank you so much.

@pdcl09
Copy link

pdcl09 commented Sep 20, 2019

@bahmutov : Are you aware of any scenario where cypress tests still fail after doing the patch fix?

@swimmer-zone
Copy link

Still having this issue on Cypress 3.4.1 on Bitbucket pipelines:

It looks like this is your first time using Cypress: 3.4.1

[12:39:34]  Verifying Cypress can run /root/.cache/Cypress/3.4.1/Cypress [started]
[12:39:34]  Verifying Cypress can run /root/.cache/Cypress/3.4.1/Cypress [failed]
Your system is missing the dependency: Xvfb

Install Xvfb and run Cypress again.

Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies

----------
Error: spawn Xvfb ENOENT
----------

I'm sure that XVFB is installed

@jennifer-shehane
Copy link
Member

The fix will for this will be released in 3.5.0. The bug will exist in 3.4.1 as noted in this comment: #5110 (comment)

@vaske
Copy link

vaske commented Oct 10, 2019

I have same error as @Yupsie :(
@jennifer-shehane thanks for update

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Oct 23, 2019

Released in 3.5.0.

@jdmairs
Copy link

jdmairs commented Nov 21, 2019

I'm still seeing this on GitLab CI with cypress v3.6.1

@vakaobr
Copy link

vakaobr commented Nov 22, 2019

+1 still seeing this on GitLab CI with cypress v3.6.1

@simholte
Copy link

+1 I'm still seeing this on GitLab CI with cypress v3.6.1

@takasoft
Copy link

It seems like I just forgot to install the dependencies. It worked after installing those.
https://docs.cypress.io/guides/guides/continuous-integration.html#Dependencies

@jennifer-shehane
Copy link
Member

This issue will be closed to further comment as the exact issue here was resolved and tested.

If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix.

@cypress-io cypress-io locked and limited conversation to collaborators Jan 2, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.