Skip to content

Reject leases that expire while waiting for the SQLite writer lock - #5

Merged
harshitethic merged 1 commit into
mainfrom
fix/lease-time-after-lock
Oct 15, 2026
Merged

harshitethic merged 1 commit into
mainfrom
fix/lease-time-after-lock

Conversation

@harshitethic

Copy link
Copy Markdown
Owner

Reproduced failure

Lease operations sampled the clock before BEGIN IMMEDIATE. A competing writer could hold the lock until the lease expired, after which complete/heartbeat/fail still accepted the old timestamp. Claim intervals and enqueue delays also included lock-wait time.

Fix

Sample time inside the acquired write transaction. Refresh claim selection time for each cleanup candidate. Preserve owner/fence/status predicates and atomic job/event writes. No database schema migration.

Six deterministic-clock tests contend against a real SQLite writer lock. All six fail on fd5a99a and pass with the fix; rejected operations leave state/events unchanged and remain reclaimable with a fresh fence.

Verification before push

  • Full 40-test suite passed on Kali/Python 3.12.14 and macOS/Python 3.14.7.
  • Existing 80-job/four-process benchmark smoke passed on both machines with all jobs accounted for.
  • Ruff lint, formatting and git diff --check passed.
  • The cloud editor blocked the existing multiprocessing manager Unix socket; device runs supplied full verification without skipping or weakening that test.

Includes an executable failure analysis, corrected architecture notes, CodeQL workflow and 0.1.3 patch-release metadata. Existing Python 3.11–3.13 CI, packaging, benchmark smoke, lint and CodeQL must pass before merge.

Limits

Time is checked during the write transaction, not at response delivery. Process pauses, slow commits, wall-clock adjustments and external side effects remain outside hard deadline/exactly-once guarantees. This is a correctness fix, not a new performance claim.

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@harshitethic
harshitethic merged commit f0a6d71 into main Oct 15, 2026
7 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.

2 participants