mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Yannick Lecaillez
14.51.2015 621bbbda7419eace24a2590c43cc531e30185c80
OPENDJ-2543: ChangelogException while doing modrate on PDB instance.

Removed deadlock when next() has the object-lock and try to get the log
's shared-lock actually held by the abortAllCursor() doing an abort()
which is waiting for the object lock held by the caller of next().
1 files modified
16 ■■■■ changed files
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java 16 ●●●● patch | view | raw | blame | history
opendj-server-legacy/src/main/java/org/opends/server/replication/server/changelog/file/Log.java
@@ -1527,7 +1527,11 @@
    }
    @Override
    public synchronized boolean next() throws ChangelogException
    public boolean next() throws ChangelogException
    {
      // This lock is needed to ensure that abort() is atomic.
      log.sharedLock.lock();
      try
    {
      if (mustAbort)
      {
@@ -1537,6 +1541,11 @@
      }
      return delegate.next();
    }
      finally
      {
        log.sharedLock.unlock();
      }
    }
    @Override
    public void close()
@@ -1565,10 +1574,9 @@
    /**
     * Aborts this cursor. Once aborted, a cursor throws an
     * AbortedChangelogCursorException if it is used.
     * <p>
     * This method is called only when log.exclusiveLock has been acquired.
     * @GuardedBy("exclusiveLock")
     */
    synchronized void abort()
    void abort()
    {
      mustAbort = true;
    }