From b889fd211a81d2208afaa1c077c1b42e6b2b2873 Mon Sep 17 00:00:00 2001
From: matthew_swift <matthew_swift@localhost>
Date: Fri, 17 Sep 2010 22:17:49 +0000
Subject: [PATCH] Fix bug which can cause replicas to diverge under heavy stress

---
 opends/src/server/org/opends/server/replication/service/ReplicationBroker.java |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
index a4ca80e..9f4a21e 100644
--- a/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
+++ b/opends/src/server/org/opends/server/replication/service/ReplicationBroker.java
@@ -2466,11 +2466,16 @@
         }
         if ((!credit) && (currentWindowSemaphore.availablePermits() == 0))
         {
-          // the window is still closed.
-          // Send a WindowProbeMsg message to wakeup the receiver in case the
-          // window update message was lost somehow...
-          // then loop to check again if connection was closed.
-          session.publish(new WindowProbeMsg());
+          synchronized (connectPhaseLock)
+          {
+            // the window is still closed.
+            // Send a WindowProbeMsg message to wakeup the receiver in case the
+            // window update message was lost somehow...
+            // then loop to check again if connection was closed.
+            if (session != null) {
+              session.publish(new WindowProbeMsg());
+            }
+          }
         }
       } catch (IOException e)
       {

--
Gitblit v1.10.0