Fix Electron single-instance and server recovery lifecycle - #1
Open
kargnas wants to merge 1 commit into
Open
Conversation
LaunchAgent가 앱을 상주시킬 때 중복 실행과 내장 서버 단독 종료가 상주 계약을 깨뜨렸습니다. 두 번째 실행은 기존 창을 활성화하고, 내장 서버가 종료되면 호스트도 종료하여 launchd가 전체 프로세스를 다시 시작하도록 변경했습니다. Constraint: Embedded server lifecycle is owned by the Electron host Rejected: External server LaunchAgent | packaged app verifies its child PID and switches ports Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep the server exit watcher disabled during intentional shutdown Tested: pnpm test; pnpm typecheck; pnpm check:electron; signed package; launchd restart and duplicate-launch smoke 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.
Why
A resident LaunchAgent could start a second Electron host. An unexpected embedded-server exit could also leave the host alive without its local server.
Root cause
The app did not own a single-instance lock. The embedded-server exit watcher was registered only after the health response body finished parsing, so a child that exited during that await could be returned as healthy. The Electron test mock also omitted the Linux app.setDesktopName API.
What changed
Verification