Skip to content

Fix-lock-errors#14

Merged
utkarsh5026 merged 3 commits intomainfrom
fix-lock-errors
Feb 19, 2026
Merged

Fix-lock-errors#14
utkarsh5026 merged 3 commits intomainfrom
fix-lock-errors

Conversation

@utkarsh5026
Copy link
Owner

Fix duplicate wait-queue entries and timeout leak in lock manager

Title: Fix duplicate wait-queue entries and timeout leak in lock manager

Summary:

  • A retry loop in LockManager.attemptToAcquireLock was re-adding the same transaction to the wait queue and dependency graph on every failed attempt, causing duplicate entries and incorrect deadlock detection.
  • On timeout, the transaction was left in the wait queue and dependency graph, leaking state and potentially causing stale wait-for edges in future lock acquisitions.
  • The FuzzLexer CI step was removed (it no longer exists or is covered elsewhere).
  • A comprehensive package-level godoc was added to pkg/concurrency/lock documenting the 2PL protocol, components, lock acquisition flow, and invariants.

Changes:

  • pkg/concurrency/lock/manager.go — guard wait-queue insertion and dependency tracking behind an addedToWaitQueue flag so they only run once per acquisition attempt; clean up queue and graph on timeout.
  • pkg/concurrency/lock/docs.go — new file with package-level godoc covering LockManager, LockTable, WaitQueue, DependencyGraph, LockGrantor, and all relevant invariants.
  • .github/workflows/ci.yml — remove the FuzzLexer fuzz step from the CI workflow.

Prevent a transaction from being added to the wait queue multiple times
across retry attempts by tracking `addedToWaitQueue`. Also clean up the
wait queue and dependency graph when the retry loop times out, avoiding
stale state in subsequent lock acquisitions.
Documents the 2PL protocol, supported lock modes, internal
subsystems (LockTable, WaitQueue, DependencyGraph, LockGrantor),
the lock acquisition flow, deadlock detection strategy, and
the invariants the package upholds.
@utkarsh5026 utkarsh5026 merged commit 48ceb80 into main Feb 19, 2026
4 of 8 checks passed
@utkarsh5026 utkarsh5026 deleted the fix-lock-errors branch February 19, 2026 05:25
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