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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 4.3.0
    • None
    • 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
          seoeun
        5. OOZIE-1922.2.patch
          4 kB
          seoeun
        6. OOZIE-1922.1.patch
          5 kB
          seoeun

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: