Infinispan
  1. Infinispan
  2. ISPN-2381

Locks are removed even if not successfully unlocked

    Details

    • Estimated Difficulty:
      High
    • Similar Issues:
      Show 10 results 

      Description

      In OwnableReentrantLock:
      If in the tryRelease(int) the owner != requestor the lock is not unlocked, it is still removed from AbstractPerEntryLockContainer.locks causing that is effectively unlocked.

      https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/util/concurrent/locks/containers/AbstractPerEntryLockContainer.java#L102
      https://github.com/infinispan/infinispan/blob/master/core/src/main/java/org/infinispan/util/concurrent/locks/OwnableReentrantLock.java#L154

        Activity

        Hide
        Radim Vansa
        added a comment - - edited

        The reason why the lock was unlocked by non-owner is that TxCompletionNotificationCommand was executed in parallel with RollbackCommand. As both these two commands do unlock for all locks closed within the transaction, when the lock is acquired by another transaction prior to the second unlock, the lock can be removed from the map.
        When the lock is removed from the map, the transaction cannot get the lock to unlock it after it finishes, therefore the lock stays closed and all transactions that wait for it fail due to timeout.

        Show
        Radim Vansa
        added a comment - - edited The reason why the lock was unlocked by non-owner is that TxCompletionNotificationCommand was executed in parallel with RollbackCommand. As both these two commands do unlock for all locks closed within the transaction, when the lock is acquired by another transaction prior to the second unlock, the lock can be removed from the map. When the lock is removed from the map, the transaction cannot get the lock to unlock it after it finishes, therefore the lock stays closed and all transactions that wait for it fail due to timeout.
        Hide
        Mircea Markus
        added a comment -

        this is integrated on master only.

        Show
        Mircea Markus
        added a comment - this is integrated on master only.
        Hide
        Dan Berindei
        added a comment -

        I integrated the fix on the 5.1.x branch as well.

        Show
        Dan Berindei
        added a comment - I integrated the fix on the 5.1.x branch as well.

          People

          • Assignee:
            Manik Surtani
            Reporter:
            Radim Vansa
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: