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

Jean-Noel Rouvignac
05.07.2013 6f6a31acb823540085555a12aa934720742b9edf
#2 Fixed a readWriteLock deadlock happening in tests on calling ChangelogDB.removeDB() which then calls ReplicationDB.shutdown().
Code is blocked acquiring a writeLock on the dbCloseLock, but a readLock is never unlocked.
Debugging showed that the ChangeNumberIndexDB is holding a cursor on a ReplicationDB, said cursor holds the readLock.
Despite the ChangeNumberIndexer thread being asked to initiateShutdown(), the thread is waiting indefinitely for new changes which will never come.

DirectoryThread.java:
In initiateShutdown(), call interrupt() to ensure the thread will be interrupted if it calls Object.wait() before checking whether it needs to shutdown, or if it is already waiting.
1 files modified
1 ■■■■ changed files
opendj-sdk/opends/src/server/org/opends/server/api/DirectoryThread.java 1 ●●●● patch | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/api/DirectoryThread.java
@@ -416,6 +416,7 @@
  public void initiateShutdown()
  {
    setThreadStateIfNotShuttingDown(ThreadState.SHUTTING_DOWN);
    interrupt();
  }
  /**