node-chrome-debug:2.47.1 xvfb-run: error: Xvfb failed to start
I have the following setup in a docker-compose.yml:
hub:
image: selenium/hub
ports:
- "4444:4444"
chrome:
image: selenium/node-chrome-debug:2.47.1
ports:
- 5900
links:
- hub
- nginx
when I launch my test, I often receive the following error from the logs of the chrome container:
xvfb-run: error: Xvfb failed to start
and my test runner (nightwatchjs) says:
Error retrieving a new session from the selenium server { status: 13, value: { class: 'org.openqa.grid.common.exception.GridException', message: 'Error forwarding the new session cannot find : Capabilities [{platform=ANY, acceptSslCerts=true, javascriptEnabled=true, browserName=chrome, name=Evaluator Login, chromeOptions={args=[--no-sandbox, --window-size=1400,1100, --lang=de, --disable-web-security]}}]' } }
When I connect with VNC to the container previous to running the tests, it works 100% of the time. However, I want this to be part of the CI process, so it also has to run unattended. Any ideas? Thanks, Marcelo
I see you run a debug node attached to the hub. Maybe there are timing issues in spinning up a hub and then adding a node...
A better way may be to start a standalone-chrome-debug image if you are running a remote driver on demand. That way you bypass the entire grid. I assume you only need one browser session.
The hub plus nodes is a good setup when you need to spin 20 nodes for example because you need to run parallel tests.
I started running into this issue as well using the node-chrome docker image.
I've just hit this, I happened to notice it started when I upgraded to docker 1.8.1 from docker 1.7.1.
Okay, after a bit of fun trying to reproduce and bisect, I've discovered why it's happening. It's actually my docker-compose upgrade that did it, not docker's upgrade. I can reproduce it on both 1.7 and 1.8.
The difference is with docker compose 1.4, if you don't use --force-recreate, then sometimes it will get stuck saying Waiting xvfb....
Now that I know this, I'm able to reproduce it without docker-compose.
In one window, run this:
$ docker run -ti --rm --name hub selenium/hub
Then in another:
$ docker run -ti --name chrome --link hub selenium/node-chrome-debug
[...snipped usual output...]
<press CTRL-C>
$ docker start -ai chrome
Waiting xvfb...
xvfb-run: error: Xvfb failed to start
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
^C/opt/bin/entry_point.sh: line 15: kill: (5) - No such process
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
^C/opt/bin/entry_point.sh: line 15: kill: (5) - No such process
Waiting xvfb...
Waiting xvfb...
Waiting xvfb...
Anyone with solution to this? I'm having the same problem standalone-firefox image:
selenium:
hostname: selenium
image: selenium/standalone-firefox:2.48.2
alexander@rincewind:~$ docker-compose -v
docker-compose version: 1.5.1
alexander@rincewind:~$ docker -v
Docker version 1.9.0, build 76d6bc9
I had the same issue as @alexander-lazarov. I was able to get past this error using selenium/standalone-firefox-debug
Intermittent "xvfb-run: error: Xvfb failed to start" on selenium/standalone-firefox-debug
I have the same issue with selenium/standalone-firefox, I've tried with different tags and it can be reproduced in all of them. Here are the results of a docker diff on the container, I hope it helps.
C /home
C /home/seluser
A /home/seluser/.cache
A /home/seluser/.cache/mozilla
A /home/seluser/.cache/mozilla/firefox
A /home/seluser/.mozilla
A /home/seluser/.mozilla/extensions
A /home/seluser/.mozilla/firefox
A /home/seluser/.mozilla/firefox/Crash Reports
A /home/seluser/.mozilla/firefox/Crash Reports/InstallTime20151030083932
A /home/seluser/.mozilla/firefox/Crash Reports/events
A /home/seluser/Desktop
C /tmp
A /tmp/.X11-unix
A /tmp/.X11-unix/X99
A /tmp/.X99-lock
A /tmp/hsperfdata_seluser
C /var
C /var/tmp
The solution for me was to use --force-recreate flag when launching through Docker Compose: "docker-compose up --force-recreate". It forces recreation of containers even if their configuration and image haven't changed.
What I noticed is that if I change the value of DISPLAY env variable from 99:0 to something different, like 98:0, it manages to start Xvfb. Not sure if this I'm forcing a recreation of the image this way (like @oholubyev proposed), or the previous display is left open/taken for some reason and you need to use a new one to start xvfb. After all, this is a container, not a whole virtual machine and I guess it is possible that something is not being cleaned completely on the host after shutdown/restart.
--force-recreate worked for me too, thanks @oholubyev
Ok it's no longer working for me, I start with 1 firefox container but when I try to scale I get the same error, and force recreate changes nothing.
Same issue
Docker: 1.10.0 Image: selenium/node-firefox:2.46.0
9 February 2016 22:36:41 GMT+2xvfb-run: error: Xvfb failed to start
I couldn't scale above one firefox node, on 5 different servers, because of this issue. For me, it was because of port 4444 conflicting, with all the nodes on the same IP...
Same issue with Docker version 1.10.2
I've tested with 2.52 version and the error continues.
We had the same problem with the standalone-chrome-debug image. The image executes the following file /opt/bin/entry-point.sh. It tries to start an xDisplay on port 99.0. After we restarted the image the following lock file was present /tmp/.X99-lock. Because of this file xvfb could not be started. We wrapped the selenium image in our own docker image and added a script to remove this lock file on startup of the container. Removing the file /tmp/.X99-lock on startup of the container fixed our problem.
@garagepoort Can you make a fix in the entry-point.sh and a pull request please?
@caioquirino: based on what @garagepoort shared, using this Dockerfile should solve the issue. Would be good if anyone can test this, because ironically, I can't reproduce the crash at the moment.
https://gist.github.com/alexander-lazarov/3851614fdd9ab33a1182
Hi @alexander-lazarov, Thank you for collaborating! :D Your gist does not work because the Dockerfile was on image's build time. The fix needs to be every time when the docker container starts (entrypoint). I will make the PR tomorrow.