Skip to content

fix(migrations): test SingletonLock liveness, not existence - #415

Open
duketopceo wants to merge 1 commit into
omacom:quattrofrom
duketopceo:fix-singleton-lock-stale
Open

fix(migrations): test SingletonLock liveness, not existence#415
duketopceo wants to merge 1 commit into
omacom:quattrofrom
duketopceo:fix-singleton-lock-stale

Conversation

@duketopceo

Copy link
Copy Markdown

Summary

Fixes #312.

profile_open() treated a dangling SingletonLock symlink as a permanently open profile — but Chromium's lock is a symlink to <hostname>-<pid> whose target file is never created, so a browser that crashes, reboots, or exits via SIGTERM leaves a lock that dangles forever. affected_profile_open() then gated on it on every run and the copy-url repair could never apply — exactly the "deadlock it set out to avoid."

The fix reads the lock's meaning instead of its existence: a symlinked lock is live only while it names a pid on this host that is still running (kill -0). A lock that is a plain file can't be attributed to a pid and is still conservatively read as held; no lock means no browser.

Test plan

  • test/shell.d/copy-url-shortcut-migration-test.sh: open_browser now points the lock at a real live pid; new cases cover a dead-pid lock (repair proceeds) and a foreign-hostname lock (treated as closed) — 15/15 pass

Generated with Devin

Chromium's SingletonLock is a symlink to <hostname>-<pid> whose target is
never created — a lock left behind by a crash or unclean shutdown dangles
forever and read as a permanently open profile, so the copy-url repair
could never apply. Liveness is the pid the lock names: a profile is open
only while the lock points at a live pid on this host. A lock file that is
not a symlink cannot be attributed and stays read as held.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@duketopceo
duketopceo force-pushed the fix-singleton-lock-stale branch from 505eb8a to 390c5a9 Compare September 12, 2026 03:54
@wesleygrimes wesleygrimes added the cherry-pick-later Port to omacom/omarchy after the overlay merges; match mainline. label Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-pick-later Port to omacom/omarchy after the overlay merges; match mainline.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

migrations/1786643346.sh: profile_open() reads a dangling SingletonLock as "browser attached", permanently blocking the migration

2 participants