docker-selenium icon indicating copy to clipboard operation
docker-selenium copied to clipboard

node-chrome-debug:2.47.1 xvfb-run: error: Xvfb failed to start

Open MarceloEmmerich opened this issue 11 years ago • 60 comments

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

MarceloEmmerich avatar Aug 21 '15 09:08 MarceloEmmerich

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.

ghost avatar Aug 28 '15 21:08 ghost

I started running into this issue as well using the node-chrome docker image.

sarahkevinking avatar Sep 01 '15 19:09 sarahkevinking

I've just hit this, I happened to notice it started when I upgraded to docker 1.8.1 from docker 1.7.1.

pwaller avatar Sep 04 '15 15:09 pwaller

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...

pwaller avatar Sep 04 '15 15:09 pwaller

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

alexander-lazarov avatar Dec 07 '15 18:12 alexander-lazarov

I had the same issue as @alexander-lazarov. I was able to get past this error using selenium/standalone-firefox-debug

bkuhl avatar Dec 09 '15 17:12 bkuhl

Intermittent "xvfb-run: error: Xvfb failed to start" on selenium/standalone-firefox-debug

oholubyev avatar Dec 21 '15 15:12 oholubyev

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

referup-tarantegui avatar Dec 23 '15 10:12 referup-tarantegui

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.

oholubyev avatar Dec 28 '15 09:12 oholubyev

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.

alexander-lazarov avatar Jan 05 '16 01:01 alexander-lazarov

--force-recreate worked for me too, thanks @oholubyev

kierr avatar Jan 23 '16 02:01 kierr

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.

kierr avatar Feb 02 '16 10:02 kierr

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

anton-kasperovich avatar Feb 09 '16 20:02 anton-kasperovich

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...

kierr avatar Feb 18 '16 04:02 kierr

Same issue with Docker version 1.10.2

SublimeVincentHerl avatar Mar 03 '16 11:03 SublimeVincentHerl

I've tested with 2.52 version and the error continues.

caioquirino avatar Mar 08 '16 19:03 caioquirino

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 avatar Mar 16 '16 14:03 garagepoort

@garagepoort Can you make a fix in the entry-point.sh and a pull request please?

caioquirino avatar Mar 16 '16 14:03 caioquirino

@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

alexander-lazarov avatar Mar 16 '16 22:03 alexander-lazarov

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.

caioquirino avatar Mar 16 '16 22:03 caioquirino