Skip to content

fix: Queue.LastSubmissionIndex deadlock — atomic instead of mutex - #289

Merged
kolkov merged 1 commit into
mainfrom
fix/deadlock-last-submission-index
Jul 30, 2026
Merged

fix: Queue.LastSubmissionIndex deadlock — atomic instead of mutex#289
kolkov merged 1 commit into
mainfrom
fix/deadlock-last-submission-index

Conversation

@kolkov

@kolkov kolkov commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Hotfix for v0.30.28 ADR-056 deadlock: Submit() → Triage() → onZero → lastSubmissionIndex() → Queue.mu — mu already held by Submit.

Fix: lastSubmissionIndex changed from mutex-protected uint64 to atomic.Uint64. Single writer (Submit), lock-free readers.

Test plan

  • All tests pass (lifecycle tests + full suite)
  • golangci-lint — 0 issues
  • Build: native + all backends

…R-056)

onZero callbacks from Triage() called lastSubmissionIndex() which locked
Queue.mu, already held by Submit(). Deadlock chain:
Submit → postSubmit → Triage → onZero → lastSubmissionIndex → Queue.mu

Fix: lastSubmissionIndex changed from mutex-protected uint64 to atomic.Uint64.
Single writer (Submit under mu), lock-free readers (onZero callbacks).
Safe because Store happens under mu (sequential) and Load is always-valid.
@codecov

codecov Bot commented Jul 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@kolkov
kolkov merged commit 92742e6 into main Jul 30, 2026
15 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