All automated test runs successfully. but xvfb issue causes the build failure in Jenkins.
I have used below commnad in ExecuteShell option available under Jenkins to run my test cases on headless browser
/usr/bin/xvfb-run /usr/local/apache-maven-3.3.1/bin/mvn clean test -Dbrowser=firefox
Getting the below output:
Results :
Tests run: 22, Failures: 0, Errors: 0, Skipped: 0
[INFO] BUILD SUCCESS
[INFO] Total time: 10:19 min
[INFO] Final Memory: 20M/47M
/usr/bin/xvfb-run: line 171: kill: (25939) - No such process
Build step 'Execute shell' marked build as failure
As we can see in the output [INFO] BUILD SUCCESS
.
But /usr/bin/xvfb-run: line 171: kill: (25939) - No such process
causes the builld failure.
Could anybody please provide some workaround for this?
Xvfb (short for X virtual framebuffer) is an in-memory display server for UNIX-like operating system (e.g., Linux). It enables you to run graphical applications without a display (e.g., browser tests on a CI server) while also having the ability to take screenshots.
The simple solution is to keep the old value of DISPLAY, change it to point to the xvfb, and then after the test is run you can change it back to the saved value. This leaves the xvfb running, so you should also get the pid of that process and kill it.
Xvfb or X virtual framebuffer is a display server implementing the X11 display server protocol. In contrast to other display servers, Xvfb performs all graphical operations in virtual memory without showing any screen output.
I had this same problem when trying to run wkhtmltopdf
thru xvfb-run
.
In my PHP script, I executed /usr/bin/xvfb-run /usr/bin/wkhtmltopdf ...
several times in the same script. The first one always worked, but the second one failed consistently with the same error you posted about.
Adding -e /tmp/xvfb.log
to the second command revealed this in the log:
Fatal server error: (EE) Server is already active for display 99 If this server is no longer running, remove /tmp/.X99-lock and start again.
The solution in my case was to add the -a
flag to the command:
/usr/bin/xvfb-run -a /usr/bin/wkhtmltopdf ...
Which will tell xvfb-run to "try to get a free server number, starting at --server-num".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With