Bug#932070: xvfb leaves lock files around if killed too early
Package: xvfb
Version: 2:1.20.4-1
Severity: normal
Tags: patch
This is probably the corner case of a corner case, but took me some
hours to debug...
When using xvfb-run inside of docker (especially as a step in a
Dockerfile), Xvfb might still be running when xvfb-run exits (since
xvfb-run kills Xvfb, but doesn't wait until it exits). Then docker comes
around and hard-kills all remaining processes, killing Xvfb before it
had time to shut down completly. This might leave at least the .X99-lock
file in /tmp around. If you then try to use xvfb-run again as a
different user, this lock file prevents the startup of Xvfb.
Attached is a simple patch which fixed the problem for me (it just waits
for Xvfb to shut down).
Regards, Tobias
-- System Information:
Debian Release: bullseye/sid
APT prefers unstable
APT policy: (500, 'unstable'), (500, 'testing'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8), LANGUAGE= (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages xvfb depends on:
ii libaudit1 1:2.8.5-1
ii libbsd0 0.9.1-2
ii libc6 2.28-10
ii libgcrypt20 1.8.4-5
ii libgl1 1.1.0-1
ii libpixman-1-0 0.36.0-1
ii libselinux1 2.9-2
ii libsystemd0 241-6
ii libunwind8 1.2.1-9
ii libxau6 1:1.0.8-1+b2
ii libxdmcp6 1:1.1.2-3
ii libxfont2 1:2.0.3-1
ii libxshmfence1 1.3-1
ii xserver-common 2:1.20.4-1
Versions of packages xvfb recommends:
ii xauth 1:1.0.10-1
xvfb suggests no packages.
-- no debconf information
diff --git a/debian/local/xvfb-run b/debian/local/xvfb-run
index af565c495..955760630 100644
--- a/debian/local/xvfb-run
+++ b/debian/local/xvfb-run
@@ -89,6 +89,7 @@ clean_up() {
fi
if [ -n "$XVFBPID" ]; then
kill "$XVFBPID" >>"$ERRORFILE" 2>&1
+ wait "$XVFBPID" >>"$ERRORFILE" 2>&1
fi
}
Reply to: