From 9e1f377c4f21b899d16f4c62450c68691f4b42a8 Mon Sep 17 00:00:00 2001
From: Ludovic Poitou <ludovic.poitou@forgerock.com>
Date: Thu, 20 Jun 2013 15:02:35 +0000
Subject: [PATCH] Fix for OPENDJ-846, Intermittent Replication failure. The issue was triggered by the mix of AssuredReplication and bad network conditions, which resulted in a deadlock between 2 RS, as both were blocked on writing to the TCP socket and not reading (because waiting on the write lock). The solution (more of a workaround) is to have another thread for sending data to the socket and have the reader and writer posting data to send to a queue that this new thread is polling. There are still potential deadlocks but they will occur much later, if the sendQueue gets full.  The code needs more work post 2.6 to be fully non blocking, but the changes are enough for now to resolve the customer deadlock case.

---
 opends/src/server/org/opends/server/replication/server/ECLServerWriter.java |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java b/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
index c718865..c2dd931 100644
--- a/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
+++ b/opends/src/server/org/opends/server/replication/server/ECLServerWriter.java
@@ -41,7 +41,7 @@
 import org.opends.server.loggers.debug.DebugTracer;
 import org.opends.server.replication.protocol.DoneMsg;
 import org.opends.server.replication.protocol.ECLUpdateMsg;
-import org.opends.server.replication.protocol.ProtocolSession;
+import org.opends.server.replication.protocol.Session;
 import org.opends.server.replication.protocol.StartECLSessionMsg;
 import org.opends.server.types.DebugLogLevel;
 import org.opends.server.types.DirectoryException;
@@ -61,7 +61,7 @@
    */
   private static final DebugTracer TRACER = getTracer();
 
-  private ProtocolSession session;
+  private Session session;
   private ECLServerHandler handler;
   private ReplicationServerDomain replicationServerDomain;
   private boolean suspended;
@@ -71,12 +71,12 @@
   /**
    * Create a ServerWriter.
    *
-   * @param session     the ProtocolSession that will be used to send updates.
+   * @param session     the Session that will be used to send updates.
    * @param handler     ECL handler for which the ServerWriter is created.
    * @param replicationServerDomain the ReplicationServerDomain of this
    *                    ServerWriter.
    */
-  public ECLServerWriter(ProtocolSession session, ECLServerHandler handler,
+  public ECLServerWriter(Session session, ECLServerHandler handler,
       ReplicationServerDomain replicationServerDomain)
   {
     super(session, handler, replicationServerDomain);

--
Gitblit v1.10.0