fix: prevent monitor shutdown deadlock (2.1.1) - #52
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.
After the first 30-second monitor health tick,
argon consolecould hang indefinitely on normal shutdown. The health loop held its mutex and called the public alert methods, which tried to acquire that same mutex. The released-binary goroutine dump confirmedMonitor.Stopwaiting for that blocked loop.Use internal alert helpers while the health loop already holds the lock, preserving locking in the public methods. Bump the shared version to 2.1.1 and update the 2.1 release notes; the published 2.1.0 tag and assets remain unchanged.
Validation: the new tests fail on the original source and pass with this patch.
go test -race ./internal/wal -run TestMonitor -count=10, the complete internal WAL unit package with race detection,go vet ./internal/wal, version consistency and all six release/installer Node tests passed. Tests cover the actual ticker and Stop, default healthy checks, repeated critical failures, recovery and public alert operations. A real CLI run through the default 30-second tick (32 seconds total) then exited normally in 0.009 seconds after SIGTERM.Remote validation: all eight checks passed on the exact PR head and again on the merge commit. PR CI, post-merge CI. 2.1.1 is now published; all five asset checksums, clean npm installation, MCP latest entry and the Homebrew source formula were verified.