Uploaded image for project: 'Oozie'
  1. Oozie
  2. OOZIE-1922

MemoryLocksService fails if lock is acquired multiple times in same thread and released

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.3.0
    • Component/s: None
    • Labels:
      None

      Description

      ReentrantLock can be acquired multiple times in same thread. For multiple acquire call, ReentrantLock hold count is incremented by one.
      So if we acquire lock multiple time from same thread, all will be successful and hold count is increased for every call.
      But if we release lock, MemoryLocksService ignore the count and deletes the lock. Even if it's held by some command.

      Simple step can reproduce it.

              service.getWriteLock("test", 5000); //writeHoldCount = 1
              MemoryLockToken lock = (MemoryLockToken)service.getWriteLock("test", 5000); //writeHoldCount = 2
              lock.release(); //writeHoldCount = 1
              lock = (MemoryLockToken)service.getWriteLock("test", 5000); //writeHoldCount = 1, it should be 2.
      
              @Override
              public void release() {
                  int val = rwLock.getQueueLength();
                  if (val == 0) {
                      synchronized (locks) {
                          locks.remove(resource);
                      }
                  }
                  lock.unlock();
              }
          }
      

      MemoryLocks should check hold count before removing lock.

        Attachments

        1. OOZIE-1922-V3.patch
          12 kB
          Purshotam Shah
        2. OOZIE-1922-V2.patch
          12 kB
          Purshotam Shah
        3. OOZIE-1922-V1.patch
          13 kB
          Purshotam Shah
        4. OOZIE-1922.3.patch
          4 kB
          Azrael Seoeun
        5. OOZIE-1922.2.patch
          4 kB
          Azrael Seoeun
        6. OOZIE-1922.1.patch
          5 kB
          Azrael Seoeun

          Issue Links

            Activity

              People

              • Assignee:
                puru Purshotam Shah
                Reporter:
                puru Purshotam Shah
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: