You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2010/03/01 22:34:47 UTC

svn commit: r917734 - /qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp

Author: aconway
Date: Mon Mar  1 21:34:47 2010
New Revision: 917734

URL: http://svn.apache.org/viewvc?rev=917734&view=rev
Log:
Fix: decoding error causes cluster broker to exit.

An error decoding a connection was causing the broker::Connection
object to be deleted in the connection IO thread rather than the
cluster deliver thread, causing an exit with "critical Modified
cluster state outside of cluster context"

Modified:
    qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp?rev=917734&r1=917733&r2=917734&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/cluster/Connection.cpp Mon Mar  1 21:34:47 2010
@@ -159,6 +159,11 @@
 
 // Received from a directly connected client.
 void Connection::received(framing::AMQFrame& f) {
+    if (!connection.get()) {
+        QPID_LOG(warning, cluster << " ignoring frame on closed connection "
+                 << *this << ": " << f);
+        return;
+    }
     QPID_LOG(trace, cluster << " RECV " << *this << ": " << f);
     if (isLocal()) {            // Local catch-up connection.
         currentChannel = f.getChannel();
@@ -231,7 +236,7 @@
         }
         else if (isUpdated()) {
             QPID_LOG(debug, cluster << " closed update connection " << *this);
-            connection->closed();
+            if (connection.get()) connection->closed();
         }
         else if (isLocal()) {
             QPID_LOG(debug, cluster << " local close of replicated connection " << *this);
@@ -250,13 +255,21 @@
 // Self-delivery of close message, close the connection.
 void Connection::deliverClose () {
     assert(!catchUp);
-    connection->closed();
+    if (connection.get()) {
+        connection->closed();
+        // Ensure we delete the broker::Connection in the deliver thread.
+        connection.reset();
+    }
     cluster.erase(self);
 }
 
 // The connection has been killed for misbehaving
 void Connection::abort() {
-    if (connection.get()) connection->abort();
+    if (connection.get()) {
+        connection->abort();
+        // Ensure we delete the broker::Connection in the deliver thread.
+        connection.reset();
+    }
     cluster.erase(self);
 }
 
@@ -324,7 +337,6 @@
     const SequenceSet& unknownCompleted,
     const SequenceSet& receivedIncomplete)
 {
-    
     sessionState().setState(
         replayStart,
         sendCommandPoint,



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