From 5916a6410762e178bee821135bc5e1059c77cab9 Mon Sep 17 00:00:00 2001 From: "phajdan.jr" Date: Thu, 4 Aug 2016 05:47:49 -0700 Subject: [PATCH] xvfb: improve robustness when stale lock files exist This ports https://codereview.chromium.org/2153083002 to src-side xvfb.py . BUG=630698, 628517 Review-Url: https://codereview.chromium.org/2216543002 Cr-Commit-Position: refs/heads/master@{#409767} --- infra/scripts/legacy/scripts/slave/xvfb.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/infra/scripts/legacy/scripts/slave/xvfb.py b/infra/scripts/legacy/scripts/slave/xvfb.py index f5f35776435852..051413aa3d2220 100644 --- a/infra/scripts/legacy/scripts/slave/xvfb.py +++ b/infra/scripts/legacy/scripts/slave/xvfb.py @@ -60,6 +60,14 @@ def StartVirtualX(slave_build_name, build_dir, with_wm=True, server_dir=None): print 'xdisplaycheck says there is a display still running, exiting...' raise Exception('Display already present.') + xvfb_lock_filename = '/tmp/.X%s-lock' % _XvfbDisplayIndex(slave_build_name) + if os.path.exists(xvfb_lock_filename): + print 'Removing stale xvfb lock file %r' % xvfb_lock_filename + try: + os.unlink(xvfb_lock_filename) + except OSError as e: + print 'Removing xvfb lock file failed: %s' % e + # Figure out which X server to try. cmd = 'Xvfb' if server_dir and os.path.exists(server_dir):