fix(core-runtime): harden SingleInstanceManager for macOS#165
Open
kdroidFilter wants to merge 2 commits intomainfrom
Open
fix(core-runtime): harden SingleInstanceManager for macOS#165kdroidFilter wants to merge 2 commits intomainfrom
kdroidFilter wants to merge 2 commits intomainfrom
Conversation
…nditions and stale files Fixes #161 — single instance mechanism broken on macOS since v1.6.0. - Add retry mechanism (3×150ms) on tryLock() to handle rapid relaunch race conditions where the previous shutdown hook hasn't released yet - Change IOException catch from fail-closed (return false → app exits) to fail-open (return true → app runs) to prevent silent termination - Clean stale .restore_request files on primary startup before watching - Delete existing restore_request before re-creating in sendRestoreRequest to avoid FileAlreadyExistsException from stale crash artifacts - Add unit tests and real multi-process integration tests
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
Fixes #161 — single instance mechanism broken on macOS since v1.6.0.
tryLockWithRetry()retries 3× with 150ms delay, handling the race condition where a rapid relaunch overlaps with the previous process's shutdown hookIOExceptioncatch now returnstrueinstead offalse, preventing silent app termination when the lock mechanism encounters filesystem errors.restore_requestfiles on primary startup and before re-creating them insendRestoreRequest, avoidingFileAlreadyExistsExceptionfrom crash leftoversTest plan
tryLockWithRetry, stale file handling, configuration, lock semantics (10 tests)kill -9(stale lock file).restore_requestfile does not prevent launch