qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r740900 - in /qpid/trunk/qpid/cpp/src/qpid/cluster: Cluster.cpp ConnectionMap.cpp ConnectionMap.h
Date Wed, 04 Feb 2009 21:31:24 GMT
Author: aconway
Date: Wed Feb  4 21:31:23 2009
New Revision: 740900

URL: http://svn.apache.org/viewvc?rev=740900&view=rev
Log:
Fix race condition with deleted local connections.

Modified:
    qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
    qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp
    qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.h

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp?rev=740900&r1=740899&r2=740900&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Cluster.cpp Wed Feb  4 21:31:23 2009
@@ -251,7 +251,8 @@
             return;
         }
         boost::intrusive_ptr<Connection> connection = connections.get(e.connectionId);
-        connection->deliveredFrame(e);
+        if (connection)         // Ignore frames to closed local connections.
+            connection->deliveredFrame(e);
     }
     QPID_LATENCY_RECORD("processed", e.frame);
 }
@@ -321,11 +322,11 @@
 
     if (state == INIT) {        // First configChange
         if (map.aliveCount() == 1) {
-            QPID_LOG(notice, *this << " first in cluster");
             setClusterId(true);
             setReady(l);
             map = ClusterMap(myId, myUrl, true);
             memberUpdate(l);
+            QPID_LOG(notice, *this << " first in cluster");
         }
         else {                  // Joining established group.
             state = JOINER;
@@ -380,8 +381,8 @@
     if (map.ready(id, Url(url))) 
         memberUpdate(l);
     if (state == CATCHUP && id == myId) {
-        QPID_LOG(notice, *this << " caught up, active cluster member");
         setReady(l);
+        QPID_LOG(notice, *this << " caught up, active cluster member");
     }
 }
 

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp?rev=740900&r1=740899&r2=740900&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.cpp Wed Feb  4 21:31:23 2009
@@ -48,7 +48,9 @@
 ConnectionMap::ConnectionPtr ConnectionMap::get(const ConnectionId& id) {
     Map::const_iterator i = map.find(id);
     if (i == map.end()) {
-        assert(id.getMember() != cluster.getId());
+        // Deleted local connection.
+        if(id.getMember() == cluster.getId())
+            return 0;
         // New remote connection, create a shadow.
         std::ostringstream mgmtId;
         mgmtId << id;

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.h
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.h?rev=740900&r1=740899&r2=740900&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.h (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/ConnectionMap.h Wed Feb  4 21:31:23 2009
@@ -55,7 +55,9 @@
     /** Erase a closed connection. Called in deliver thread. */
     void erase(const ConnectionId& id);
 
-    /** Get an existing connection. */ 
+    /** Get an existing connection. Returns 0 if id is a closed local
+     * connections, frames for closed connections should be ignored.
+     */ 
     ConnectionPtr get(const ConnectionId& id);
 
     /** Get connections for sending an update. */



---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:commits-subscribe@qpid.apache.org


Mime
View raw message