fix(runtime): never delete a browser profile lock a live process still holds - #40
Merged
Merged
Conversation
…l holds The launcher treated every SingletonLock as stale and removed it before starting Chromium. That is right after a crash and wrong while another run is going: Chromium writes the lock precisely to keep two instances off one profile, so clearing a live one invites the corruption it guards against. When the delete does not take, the person gets a raw ProcessSingleton dump that blames Chromium instead of naming the run actually holding the profile. Read the lock's `<host>-<pid>` target, and when that pid is still alive stop with a message that says which run holds the profile and how to clear it. Stale locks are removed exactly as before.
Contributor
|
🎉 This PR is included in version 0.24.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
launchPersistentContextremovedSingletonLockunconditionally before every launch, on the assumption that the lock is always debris from a crash. That assumption is only half true:And when the removal does not take, the person sees a raw
ProcessSingletoncall log blaming Chromium, with no hint that anothervana connectis the thing holding the profile.This reads the lock's symlink target (
<hostname>-<pid>, where the hostname itself may contain dashes, so only the final segment is the pid) and checks whether that pid is alive. Live holder: stop with a message naming the pid and how to clear it. Dead or unparseable: remove as stale, as before.How this showed up
A
vana connect linkedin --json --ipcrun opened a headed Chrome for manual sign-in and parked atComplete any remaining verification, then click "Done". Nobody clicked it. Ninety-five minutes later it still held the profile, and every retry failed with the Chromium dump:After this change that reads:
Follow-up worth tracking separately
An interactive prompt under
--json --ipchas no visible UI and no timeout, so it can block a profile indefinitely. Detecting the lock turns that into a clear message, but the underlying "interactive prompt in a non-interactive run" case still deserves a timeout.Test plan
pnpm validategreen (376 tests)