Repository navigation
fix: handle database readers and immediate stops during daemon startup - #1530
Merged
Merged
Conversation
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.
Daemon startup can leave an owner in
startingwhen a CLI reader briefly holds install.db: the entrypoint bypassed the shared SQLite busy timeout, somarkReady()could throwdatabase is locked. Use the verified sharedopenInstallDb()for the claim connection, and give the bootstrap read-only connection the same five-second bounded wait. Operation-lock probes remain nonblocking.An immediate stop also exposed
ReferenceError: Cannot access 'timer' before initializationatdoStop()in captured daemon stderr. Declare the polling timer before startup so the control handler can stop safely before interval initialization.Add an entrypoint regression that synchronizes a separate read transaction at the ready-write boundary. The second-start CLI test now prints daemon logs on failure for both starts. The #1529 failure at line 189 was the first start; the second start had not executed. The original CI exception was not captured, so the reproduced SQLite race is a confirmed defect rather than a proven attribution of that CI failure.
Validation: the new regression fails on the original entrypoint with
database is lockedatmarkReady(), and passes with the fix. All four entrypoint bats tests, seven relevant daemon CLI bats tests, and thirteen database/owner/main Node tests pass on macOS. Local bats verification used a scratch helper copy with HOME reassignment and directory deletion disabled; resident-manager registration cases were excluded. Linux verification is left to CI.