fix: cover the public Acquire path in the distributed-lock heartbeat fix (#79) - #9
Merged
Merged
Conversation
…fix (raisedapp#79) The previous fix only routed the heartbeat onto a dedicated connection for the internal (storage-aware) acquisition paths. The public SQLiteDistributedLock.Acquire(resource, timeout, database, options) overload — used by the exact repro in issue raisedapp#79 — still ran the heartbeat on the caller's connection and crashed the process reliably. When no storage/pool is available, the heartbeat now opens its own dedicated FullMutex connection to the same database (honouring URI/shared in-memory paths) instead of touching the caller's connection. Wire up the issue's repro as a regression test (Issue79ReproFacts): it crashed 3/3 before and passes 3/3 after, with the full suite stable across repeated runs on macOS. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017xW2zhMvrJChpY58hfJBeZ
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.
Follow-up to #8. That PR only moved the heartbeat onto a dedicated connection for the internal (storage-aware) acquisition paths. The public
SQLiteDistributedLock.Acquire(resource, timeout, database, options)overload — which is exactly what the issue #79 repro uses — still ran the heartbeat on the caller's connection and crashed the test host reliably (3/3).Fix
When no storage/pool is available, the heartbeat now opens its own dedicated
FullMutexconnection to the same database (honouring URI / shared in-memory paths) rather than touching the caller's connection.Tests
Wires up the issue's exact repro as
Issue79ReproFacts.Use_Connection_When_Heartbeat_Fires— the only test case the ticket provided. It crashed 3/3 before, passes 3/3 after, and the full suite (204 tests) is stable across 5 consecutive runs on macOS (the OS the CI crash occurred on). This also resolves the macOS CI host-crash, which came from existing lock tests using the same public path under parallel load.