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

Jean-Noel Rouvignac
17.30.2013 407101fb21106bb8697aa771826638a41b968f3a
refs
author Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Tuesday, December 17, 2013 17:30 +0100
committer Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Tuesday, December 17, 2013 17:30 +0100
commit407101fb21106bb8697aa771826638a41b968f3a
tree 059ef5e6d4f1eff9bad30faf15e942b648df3972 tree | zip | gz
parent 576b1a99211ebdcc996a9a3991f31a339477090f view | diff
OPENDJ-1172 Deadlock between replication threads during shutdown

Review of the approach: Matthew Swift


Problem is caused by code deep into method calls that calls ReplicationServer.shutdown().
Thread 1 holds a lock on MessageHandler.msgQueue, an exception happens during processing and it then it calls ReplicationServer.shutdown() which then goes and tries to grab JEReplicaDB.msgQueue.
Thread 2 holds a lock on JEReplicaDB.msgQueue and then tries to grab MessageHandler.msgQueue.

The proper fix is to let the exceptions bubble up to the Thread.run() method, releasing all locks in the process, and call ReplicationServer.shutdown() from there.


replication.properties
Added stack traces to error messages.

ReplicationServerDomain.java:
Consequence of the change to the error messages, removed the use of MessageBuilder.

JEUtils.java: ADDED
Factorized all the code closing JE Transactions.

DraftCNDB.java, JEChangeNumberIndexDB.java, ReplicationDB.java:
Let ChangelogExceptions propagate up.
Used JEUtils.abort().
Consequence of the change to the error messages, removed the use of MessageBuilder.

JEReplicaDB.java:
Handled ChangelogException bubbling up here.
Extracted stop(Exception) method.

ReplicationDbEnv.java
removed one shutdownOnException() method.
Inlined innerShutdownOnException().
Consequence of the change to the error messages, removed the use of MessageBuilder.
1 files added
7 files modified
358 ■■■■ changed files
opendj-sdk/opends/src/messages/messages/replication.properties 6 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/ReplicationServerDomain.java 7 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/DraftCNDB.java 81 ●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEChangeNumberIndexDB.java 28 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEReplicaDB.java 63 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/JEUtils.java 74 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDB.java 73 ●●●●● diff | view | raw | blame | history
opendj-sdk/opends/src/server/org/opends/server/replication/server/changelog/je/ReplicationDbEnv.java 26 ●●●●● diff | view | raw | blame | history