Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-2381

Locks are removed even if not successfully unlocked

    Details

      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

        Gliffy Diagrams

          Activity

          Hide
          rvansa 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
          rvansa 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 Mircea Markus added a comment -

          this is integrated on master only.

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

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

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

            People

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

              Dates

              • Created:
                Updated:
                Resolved:

                Development