Skip to content

fix: cover the public Acquire path in the distributed-lock heartbeat fix (#79) - #9

Merged
tbbuck merged 1 commit into
masterfrom
fix/distributed-lock-heartbeat-public-path
Jun 24, 2026
Merged

tbbuck merged 1 commit into
masterfrom
fix/distributed-lock-heartbeat-public-path

Conversation

@tbbuck

@tbbuck tbbuck commented Jun 24, 2026

Copy link
Copy Markdown
Owner

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 FullMutex connection 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.

…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
@tbbuck
tbbuck merged commit 4a2a5f4 into master Jun 24, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant