Clear the stale Chrome singleton lock at browser boot #76
Reference in New Issue
Block a user
Delete Branch "fix/stale-chrome-singleton-lock"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Symptom
The VPS could not reach the browser over the tailnet. Ping to the tailnet IP worked,
docker-proxywas listening on100.x:9222, andcurlconnected — then died withRecv failure: Connection reset by peer.docker logs bookmark-browserheld one line, from the previous run's shutdown.Cause
Chrome's
SingletonLockin thechrome-profilevolume names the hostname and pid that took it. Both change ondocker compose up --build, so a Chrome that died uncleanly leaves a lock the next container reads as "The profile appears to be in use by another Google Chrome process (28349) on another computer (dd6e8d098e59)" and exits immediately. The volume outlives every recreate, so this never self-heals.The reset follows from
entrypoint.sh: socat accepts,start_browserfires, Chrome exits,wait_for_browserbails onbrowser_alive(:104), the helper returns 1 and closes the socket.Change
rm -f "$profile"/Singleton*in the boot-time state reset, beside the connection markers and pid file. Safe becausecontainer_namepins this volume to one container — nothing can hold the profile when that line runs. Clearance cookies sit beside it and are untouched./dev/null, and the give-up path says why it gave up. Without these the failure is indistinguishable from a network fault, which is what made it expensive to find.Scope: a lock left mid-container-lifetime is self-healing (same hostname, dead pid), so boot is the entire exposure.
Verification
sh -n chrome/entrypoint.shclean. Deployed withdocker compose up -d --build;/json/versionanswers.Upstream, still open: whatever killed Chrome uncleanly —
mem_limit: 512magainst the Gitea runner is the suspect (ADR-0006). This makes that failure recoverable rather than terminal.