During the code review for
OPENDJ-6325, a few problems became apparent with the ReplaySynchronizer:
- In UpdateReplayThreadPool.ReplayThread.run(), when the thread exits the loop, because of shutdown, ReplaySynchronizer.notifyAllReplaysDone() is never called while it looks like it should.
- Risk: Replica listener threads remain blocked - will prevent the server from stopping
- In that case, this will unlock the replica listener thread, which will end up calling UpdateReplayThreadPool.offer(), which will throw a IndexOutOfBoundsException because updateQueues has been cleared
- Another issue with UpdateReplayThreadPool.ReplaySynchronizer.waitForAllReplaysDone() is the case of spurious wake-ups: when Semaphore.acquire(int) throws InterruptedException (because of spurious wake-up) it will incorrectly execute the following code in the finally block:stopTheWorld = false;
There may be some other concurrency issue as well.
This issue can be considered to be fixed when all identified concurreny issues are addressed.