Comments (26)
I ran into the same problem. After removing network_mode: 'host'
it works. Is there a fix for this?
from cypress-docker-images.
I was having the same issue, and what fixed it was adding:
environment:
- DISPLAY
to the cypress service in docker-compose.
from cypress-docker-images.
I hit this as well, because we were running Selenium tests on the the Circle CI server as well as Cypress tests, and by the time we ran the Cypress tests we had already started Xvfb
.
Simply killing Xvfb
before running cypress
fixed the problem: sudo pkill Xvfb
.
from cypress-docker-images.
Having the same issue when I run my docker-compose setup.
version: '3.3'
services:
angular-app:
build:
context: .
dockerfile: Dockerfile
ports:
- '80:80'
cypress-e2e:
build:
context: ./e2e
dockerfile: Dockerfile.cypress
depends_on:
- angular-app
network_mode: host
my Cypress docker file:
FROM cypress/browsers:chrome69
# set working directory
WORKDIR /usr/app-e2e
ENV PATH /usr/app-e2e/node_modules/.bin:$PATH
# install and cache app dependencies
COPY . /usr/app-e2e
RUN npm install
Also tried cypress/base
as base image, but didn't change anything
from cypress-docker-images.
let's debug this problem
- do you have complete minimal repo I could clone and run?
- our xvfb logic is https://github.com/cypress-io/xvfb and you can see debug messages from this module by running like this https://github.com/cypress-io/xvfb#debugging
- you can also turn on debug messages from Cypress NPM package that calls XVFB with
DEBUG=cypress:cli
so that should show something
We have this problem occasionally on Travis CI but not on Circle for example, so we strongly think this is due to some bugs in containers not with the logic or time outs
from cypress-docker-images.
@bahmutov Thanks for your hints. Gonna check some of them out. I'm using a setup similar to here as I need to run a docker-compose setup on CircleCI.
Basically I'm having an Angular app that's being booted and the Cypress container then runs the tests against that. Gonna check some of your debugging tips. locally on my machine it works. On CircleCI however I get the error 🤔
Creating network "project_default" with the default driver
Creating project_angular-app_1 ...
Creating project_angular-app_1
⠙ Verifying Cypress can run /root/.cache/Cypress/3.1.0/Cypress
✖ Verifying Cypress can run /root/.cache/Cypress/3.1.0/Cypress
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: _XSERVTransSocketUNIXCreateListener: ...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 (Debian - 8.11)
Cypress Version: 3.1.0"
----------
Platform: linux (Debian - 8.11)
Cypress Version: 3.1.0
Exited with code 1
from cypress-docker-images.
hmm, weird, but hard for me to recreate, a complete repro would be ideal. Does this happen every time?
from cypress-docker-images.
yes. I'll try to create a small sample repo and share it on GitHub
from cypress-docker-images.
@bahmutov I have a repro repository here: https://github.com/juristr/nx-cypress-ci-setup
I can also add you (or anyone else) as a collaborator if that makes it easier to debug the issue. Locally it works just fine, when executed on CircleCI I get the error as seen here: https://circleci.com/gh/juristr/nx-cypress-ci-setup/3
Let me know if I can help
from cypress-docker-images.
@juristr I did not have time to debug the issue, but take a look at https://github.com/cypress-io/xvfb - this is the XVFB module we use to try to start the server (see #54 (comment))
Could you debug this problem in Circle by rerunning the job with SSH and maybe even editing the code in node_modules/@cypress/xvfb
directly?
from cypress-docker-images.
Could you debug this problem in Circle by rerunning the job with SSH
Oh alright, didn't know I can debug CircleCI via SSH. thx, will let you know 👍
from cypress-docker-images.
I spent some time removing as many variables as I could to fix this problem, and it appears that running selenium alongside your other docker instances can cause this issue to appear.
from cypress-docker-images.
The problem is that when running in host mode, the X server port can be shared across cypress instances, the host machine itself, or something else (selenium). To fix we should use a nonstandard port for the xvfb instance within the container. You can also find the original X server and kill it first (in my case, Circle CI machine executor image has one.)
These issues are connected
https://github.com/cypress-io/cypress-docker-images/issues/39
cypress-io/cypress#1426
cypress-io/cypress#673
cypress-io/cypress#457
from cypress-docker-images.
@bahmutov Any updates here?
from cypress-docker-images.
@tylergets would you like to implement a detection for XVFB running already (probably in https://github.com/cypress-io/xvfb) and maybe a fix?
from cypress-docker-images.
Hi all. I've raised PR cypress-io/cypress#5035 containing the workaround we've used in my team for this issue. We've exposed an environment variable hook to allow us to control the XVFB port used, thereby allowing us to ensure that each of the containers participating in our parallel Cypress run does so using a different port number.
While this doesn't address the underlying issue in the way that @bahmutov's suggestion would, it may at least help others work around this problem by giving them control of the XVFB port used until such time as that fix can be implemented.
from cypress-docker-images.
we have released Cypress v3.5.0 with a timeout of 30 seconds, I hope it helps.
from cypress-docker-images.
Hi all. I've raised PR #54 containing the workaround we've used in my team for this issue.
@davidedwards88 The PR link just leads back to this page. Was it merged, or do you have a copy somewhere?
from cypress-docker-images.
@thomasactia Apologies, I hadn't realised I'd included an incorrect link in my comment. I've been able to find the PR I should have referenced, which can be found at cypress-io/cypress#5035 (I've now updated my original comment also).
As per the comments in that PR, unfortunately it went un-merged as I did not have time to address the feedback given.
from cypress-docker-images.
I'm running into this on the newest Cypress version (6.5.0
). Any chance there's an update on a fix/workaround for this issue? Happy to provide more details as needed.
from cypress-docker-images.
I'm seeing this with Cypress version 6.6.0 and 6.4.0, using cypress/included:6.6.0
in CircleCI. Also happy to provide more details!
from cypress-docker-images.
@dalgarno's solution worked for me, ie:
environment: - DISPLAY
So full config for docker-compose for cypress is something like:
version: "3"
services:
cypress:
build:
context: path/for/context
dockerfile: path/to/Dockerfile
# So cypress can reach localhost
network_mode: host
environment:
# Required to prevent an issue with cypress complaining about xvfb
# See https://github.com/cypress-io/cypress-docker-images/issues/54#issuecomment-569427367
DISPLAY:
# Needed so chromium doesn't crash
# See https://github.com/cypress-io/cypress/issues/350
ipc: host
from cypress-docker-images.
I have a temporary solution to solve server already running
caused by network_mode: host
in my project.
Check xvfb port and generate cypress-xvfb lock file before running cypress
prepare_xvfb () {
# delete all cypress-xvfb lock file
[ -f /tmp/.X*-lock ] && rm -f /tmp/.X*-lock
local display_num=99
local loop=true
while [ $loop == 'true' ]
do
# xvfb port
if [ $display_num -ge 100 ]; then
local xvfb_port="6$display_num"
else
local xvfb_port="60$display_num"
fi
# generate cypress-xvfb lock file
nc -z 127.0.0.1 "$xvfb_port" || local occupied=false
if [[ "$occupied" == "false" ]]; then
local loop=false
else
echo "[ Info ] xvfb display number :${display_num} was occupied. Check next"
echo "<my project> placeholder" > "/tmp/.X${display_num}-lock"
let display_num++
fi
done
echo "[ Info ] xvfb will use display :${display_num}."
}
Cypress version in my project is 3.8.0 and @cypress/xvfb version is 1.2.4. Cypress-xvfb lock file used in https://github.com/cypress-io/xvfb/blob/0051191e4953a2a922086dcdc5c4aae3aecfe5b1/index.js#L128
from cypress-docker-images.
We are seening it recently in CI with GHA large runners.. 😕
from cypress-docker-images.
We are seening it recently in CI with GHA large runners.. 😕
Do you have details about which Cypress Docker image you are using, which version of Cypress and what your host environment is?
Could you provide up-to-date logs?
from cypress-docker-images.
Closing due to inactivity.
from cypress-docker-images.
Related Issues (20)
- Outdated Node.js 18.x images HOT 3
- Request for feature branch Cypress and Node.js latest HOT 3
- Outdated legacy examples/included-as-non-root HOT 1
- Obsolete examples/included-as-non-root-alternative HOT 1
- Review: examples/included-as-non-root-mapped
- Review: examples/included-with-plugins
- "Push Factory Image" failure checking `cypress/factory:4.0.1` HOT 9
- Migrate to current Docker version HOT 1
- cypress/browsers image suddenly has a /root/.ssh directory HOT 3
- Short tag cypress/included:13.11.0 points to Node.js 18.20.3 versions HOT 1
- The automation client disconnected. Cannot continue running tests. Cypress 12.14.0 Firefox 126 (headless) Node 18.8.0 HOT 9
- Add examples: cypress/base, cypress/browsers and GitHub Actions HOT 5
- Feature Branch Request HOT 4
- Security scan of `cypress/included:latest` have significant vulnerability findings HOT 5
- Critical vulnerabilities reported for cypress/factory HOT 6
- Non-fatal caching error with cypress/included in GitHub Actions with non-root user
- Run Cypress interactive GUI on host, but run tests in Docker container HOT 5
- Outdated Cypress Docker Hub Overviews HOT 3
- Suppress publication of cypress/browsers arm64 images with no browsers
- arm64 images contain no browsers HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cypress-docker-images.