Race condition in /usr/bin/xvfb-run causes concurrent invocations to fail

Bug #348052 reported by Andrew Pollock on 2009-03-24
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
xorg-server (Debian)
Fix Released
Unknown
xorg-server (Ubuntu)
Medium
Unassigned
Nominated for Hardy by Andrew Pollock
Nominated for Intrepid by Andrew Pollock
Nominated for Jaunty by Andrew Pollock

Bug Description

We have users that sometimes run xvfb-run multiple times concurrently for
running builds. They tell me there is a >50% chance that doing so will cause a
failure due to a race condition in how the server number is determined.

Related branches

Andrew Pollock (apollock) wrote :
Bryce Harrington (bryce) on 2009-04-02
Changed in xorg-server (Ubuntu):
assignee: nobody → bryceharrington
importance: Undecided → Medium
status: New → Fix Committed
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.6.0-0ubuntu9

---------------
xorg-server (2:1.6.0-0ubuntu9) jaunty; urgency=low

  * local/xvfb-run: Fixes race condition with concurrent invocations
    (LP: #348052)
  * local/xvfb-run, xvfb-run.1: Add correct docs about error codes
    (LP: #328205)
  * local/xserver-xephyr.1, rules, xserver-xephyr.install: Add man page
    for xephyr
    (LP: #134906)

 -- Bryce Harrington <email address hidden> Wed, 01 Apr 2009 20:37:22 -0700

Changed in xorg-server (Ubuntu):
status: Fix Committed → Fix Released
Bryce Harrington (bryce) wrote :

Rejecting patch. Caused two issues identified in bug 357338.

Changed in xorg-server (Ubuntu):
status: Fix Released → Incomplete
Andrew Pollock (apollock) wrote :

Damn. Sorry about that. So what you prefer...

1) A patch that makes it #!/bin/bash
2) A patch that removes the bashisms?

On Tue, Apr 07, 2009 at 11:04:59PM -0000, Andrew Pollock wrote:
> Damn. Sorry about that. So what you prefer...
>
> 1) A patch that makes it #!/bin/bash
> 2) A patch that removes the bashisms?

We need to stick with dash, so removing the bashisms is needed.
Also check with seb128 to make sure this doesn't break his use case.
(He uses xvfb for testing Gnome Desktop applications for Ubuntu.)

Bryce Harrington (bryce) on 2009-04-24
Changed in xorg-server (Ubuntu):
assignee: Bryce Harrington (bryceharrington) → nobody
cburroughs (chris-burroughs) wrote :

I can not claim if this is idiomatic or not, but the attached patch allows Andrew Pollock to run for me with dash.

Past about 10 concurrent Xvfbs I get several messages along the lines of:

XIO: fatal IO error 11 (Resource temporarily unavailable) on X server ":658.0"
      after 102 requests (90 known processed) with 0 events remaining.

But they do not appear to indicate a problem; a script to take 100 screenshots of xclock in separate Xvfbs produced 100 valid screenshots despite several messages like the one above.

Andrew Pollock (apollock) wrote :

Thanks Chris! I hadn't had a chance to revisit this patch and remove the bashism since it was identified as being a problem.

Changed in xorg-server (Debian):
status: Unknown → New
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package xorg-server - 2:1.6.4-2ubuntu3

---------------
xorg-server (2:1.6.4-2ubuntu3) karmic; urgency=low

  * local/xvfb-run: Fix race condition in xvfb-run that can cause
    concurrent invocations to fail.
    (LP: #348052)

 -- Bryce Harrington <email address hidden> Wed, 14 Oct 2009 15:21:51 -0700

Changed in xorg-server (Ubuntu):
status: Incomplete → Fix Released
Changed in xorg-server (Debian):
status: New → Fix Committed
Changed in xorg-server (Debian):
status: Fix Committed → Fix Released
Steffen Neumann (sneumann) wrote :

Hi,

I am unsure whether this is fixed in xvfb 2:1.7.6-2ubuntu7.2,
because I am experiencing the symptoms that xvfb fails to start
with multiple concurrent invocations on a single host.
(We're using xvfb-run in job scripts submitted to the gridengine queueing system,
 which schedules as many jobs as cores on one host).

I have attached the output of sh -x xvfb-run, please let me know
if I missed something obvious, or whether I should provide more information,
and whether this should be opened as a new bug.

Yours,
Steffen

+ set -e
+ PROGNAME=xvfb-run
+ SERVERNUM=99
+ AUTHFILE=
+ ERRORFILE=/dev/null
+ STARTWAIT=3
+ XVFBARGS=-screen 0 640x480x8 -extension Composite
+ LISTENTCP=-nolisten tcp
+ XAUTHPROTO=.
+ awk {print $2}
+ stty size
+ DEFCOLUMNS=
+ expr : [[:digit:]]\+$
+ DEFCOLUMNS=80
+ getopt --options +ae:f:hn:lp:s:w: --long auto-servernum,error-file:,auth-file:,help,server-num:,listen-tcp,xauth-protocol:,server-args:,wait: --name xvfb-run -- echo mzData
+ ARGS= -- 'echo' 'mzData'
+ GETOPT_STATUS=0
+ [ 0 -ne 0 ]
+ eval set -- -- 'echo' 'mzData'
+ set -- -- echo mzData
+ :
+ shift
+ break
+ [ ]
+ [ -z echo mzData ]
+ which xauth
+ trap clean_up EXIT
+ [ -z ]
+ mktemp -d -t xvfb-run.XXXXXX
+ XVFB_RUN_TMPDIR=/tmp/414629.1.MSBI2/xvfb-run.z3JMeX
+ tempfile -n /tmp/414629.1.MSBI2/xvfb-run.z3JMeX/Xauthority
+ AUTHFILE=/tmp/414629.1.MSBI2/xvfb-run.z3JMeX/Xauthority
+ mcookie
+ MCOOKIE=d3693c2fa8bd05f29a9154f8ca87ee88
+ tries=10
+ [ 10 -gt 0 ]
+ tries=9
+ XAUTHORITY=/tmp/414629.1.MSBI2/xvfb-run.z3JMeX/Xauthority xauth source -
+ XVFBPID=4022
+ sleep 3
+ XAUTHORITY=/tmp/414629.1.MSBI2/xvfb-run.z3JMeX/Xauthority Xvfb :99 -screen 0 640x480x8 -extension Composite -nolisten tcp
+ kill -0 4022
+ [ -n ]
+ error Xvfb failed to start
+ message error: Xvfb failed to start
+ fmt -t -w 80
+ echo xvfb-run: error: Xvfb failed to start
xvfb-run: error: Xvfb failed to start
+ exit 1
+ clean_up
+ [ -e /tmp/414629.1.MSBI2/xvfb-run.z3JMeX/Xauthority ]
+ XAUTHORITY=/tmp/414629.1.MSBI2/xvfb-run.z3JMeX/Xauthority xauth remove :99
+ [ -n /tmp/414629.1.MSBI2/xvfb-run.z3JMeX ]
+ rm -r /tmp/414629.1.MSBI2/xvfb-run.z3JMeX
XVFB: Error code 1

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.