Skip to content

IGNITE-29233 Fix explicit lock left acquired when its timeout expires during mapping - #13775

Open
NSAmelchev wants to merge 2 commits into
apache:masterfrom
NSAmelchev:ignite-29233
Open

NSAmelchev wants to merge 2 commits into
apache:masterfrom
NSAmelchev:ignite-29233

Conversation

@NSAmelchev

Copy link
Copy Markdown
Contributor

GridDhtColocatedLockFuture completes a timed out future without synchronizing with the mapping thread. If the timeout expires while the keys are still being mapped on the local primary node (a GC pause longer than the timeout is enough), undoLocks finds nothing yet, and the mapping then registers the candidates for the completed future: tryLock returns false, but the key stays locked with no owner thread, the thread's next lock of the key passes as a reentry of the leaked candidate, and the next partition map exchange waits for the span forever.

Changes

  • mapAsPrimary and cancel() of an explicit lock are serialized with the timeout callback on the timeout object monitor: a completed future registers nothing, everything registered before is undone by the completion. Transactions release their candidates on rollback and are not affected.
  • A reentry remembers the version of the lock future that created it (GridCacheMvccCandidate#reentryVer), so the rollback of a failed future removes its reentry instead of leaving it in the span.

Visible behavior: tryLock(timeout) paused during mapping longer than the timeout now acquires the lock if the key is free (returns true later than the timeout) instead of returning false and leaving the key locked.

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