From 147ad3dac5f39922198164efb91cddc2c8f4bc62 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 10 Jun 2026 10:07:32 -0500 Subject: fix(theme-studio): guard Chrome profile dir and bound headless renders A headless render with an empty --user-data-dir falls back to the real Chrome profile and takes its SingletonLock. A hung render held that lock for 18 hours on 2026-06-09, blocking every interactive Chrome launch. The runner now refuses to run the browser gates when mktemp fails, and each render runs under timeout --kill-after so a wedged Chrome dies in seconds. --- scripts/theme-studio/run-tests.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts/theme-studio') diff --git a/scripts/theme-studio/run-tests.sh b/scripts/theme-studio/run-tests.sh index 2f46602c..c8e34fe9 100755 --- a/scripts/theme-studio/run-tests.sh +++ b/scripts/theme-studio/run-tests.sh @@ -59,11 +59,14 @@ if [ "$NO_BROWSER" = 1 ]; then elif [ -z "$CHROME" ]; then for t in $HASHES; do skip_msg "#$t (no Chromium-family browser found)"; done else - PROF="$(mktemp -d)" + # An empty --user-data-dir makes Chrome fall back to the user's real default + # profile and take its SingletonLock; a hung headless render then blocks every + # interactive Chrome launch until killed. Never let an empty PROF reach Chrome. + PROF="$(mktemp -d)" && [ -n "$PROF" ] || { echo "mktemp -d failed — refusing to run browser gates" >&2; exit 1; } trap 'rm -rf "$PROF"' EXIT for t in $HASHES; do upper="$(echo "$t" | tr '[:lower:]' '[:upper:]')" - res="$("$CHROME" --headless --no-sandbox --disable-gpu --user-data-dir="$PROF" \ + res="$(timeout --kill-after=5 30 "$CHROME" --headless --no-sandbox --disable-gpu --user-data-dir="$PROF" \ --virtual-time-budget=8000 --dump-dom "file://$HERE/theme-studio.html#$t" 2>/dev/null \ | grep -o "${upper}[^<]*" | head -1)" case "$res" in -- cgit v1.2.3