Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

fix(scripts): stop calling a stale Chromium lock an open browser

Yudhi Armyndharis72fdd662d5db
diff --git a/scripts/backup.sh b/scripts/backup.sh
index 528428200..58d6cc613 100755
--- a/scripts/backup.sh
+++ b/scripts/backup.sh
@@ -203,12 +203,13 @@ fi
if [ -d "$SESSIONS_DIR" ]; then
log "Backing up whatsapp-web.js sessions"
cp -pRH "$SESSIONS_DIR" "$STAGE/sessions"
- # Chromium holds a SingletonLock (a symlink, so not `-e`) in every profile it has open, and the
- # entrypoint clears stale ones at start, so a lock here means a browser was writing that profile.
+ # Chromium holds a SingletonLock (a symlink, so not `-e`) in every profile it has open. A browser
+ # killed outright (force-kill, a stop that timed out) leaves its lock behind until the next launch
+ # or container start clears it, so a lock here means the profile is open or was last hard-killed.
OPEN_PROFILES="$(find -H "$SESSIONS_DIR" -mindepth 2 -maxdepth 2 -name SingletonLock -exec dirname {} \; |
sed 's|.*/||' | sort | tr '\n' ' ')"
if [ -n "$OPEN_PROFILES" ]; then
- record_engine_state_note "sessions/ (whatsapp-web.js profiles open in a browser: ${OPEN_PROFILES% })"
+ record_engine_state_note "sessions/ (whatsapp-web.js profiles holding a Chromium SingletonLock, open or left by a killed browser: ${OPEN_PROFILES% })"
fi
else
log "WARN: $SESSIONS_DIR not found — skipping sessions"
diff --git a/scripts/smoke-test-backup-restore.sh b/scripts/smoke-test-backup-restore.sh
index aff62dbe2..79711c2a0 100755
--- a/scripts/smoke-test-backup-restore.sh
+++ b/scripts/smoke-test-backup-restore.sh
@@ -1194,7 +1194,7 @@ printf '{}' >"$AA/src/data/baileys/s1/creds.json"
OUT_AA="$(cd "$AA/src" && BACKUP_DIR="$AA/out" "$BACKUP" 2>&1)"
ARCHIVE_AA="$(ls "$AA"/out/openwa-backup-*.tar.gz)"
NOTE_AA="$(tar -xOzf "$ARCHIVE_AA" ./ENGINE-STATE-NOTE 2>/dev/null || true)"
-if ! printf '%s\n' "$NOTE_AA" | grep -q 'open in a browser: session-s1)' ||
+if ! printf '%s\n' "$NOTE_AA" | grep -q 'open or left by a killed browser: session-s1)' ||
! printf '%s\n' "$NOTE_AA" | grep -q '^baileys/'; then
fail "(aa) the archive does not note the open profile and the Baileys state: $NOTE_AA"
fi