summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2010-03-15 20:08:10 +0000
committerAlan Conway <aconway@apache.org>2010-03-15 20:08:10 +0000
commit600a7bfe6b25448f68f266996a2f8e6700c69eac (patch)
tree5a45a4ef67cc2ff603635028e7d381429089272d /qpid/cpp
parentc698c596d5d79dcaee85227186d0361ff76a0dae (diff)
downloadqpid-python-600a7bfe6b25448f68f266996a2f8e6700c69eac.tar.gz
Work-around for race condition in the IO layer.
Added a 100ms sleep in UpdateClient between calling Connection::close() and destroying the Connection object. This appears to work around the race condition described in https://bugzilla.redhat.com/show_bug.cgi?id=568831. which was causing brokers to seg fault sporadically at the end of giving an update. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@923414 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/cluster/UpdateClient.cpp6
-rw-r--r--qpid/cpp/src/tests/ClusterFixture.cpp4
2 files changed, 8 insertions, 2 deletions
diff --git a/qpid/cpp/src/qpid/cluster/UpdateClient.cpp b/qpid/cpp/src/qpid/cluster/UpdateClient.cpp
index 17d856b79c..ab992bf8cf 100644
--- a/qpid/cpp/src/qpid/cluster/UpdateClient.cpp
+++ b/qpid/cpp/src/qpid/cluster/UpdateClient.cpp
@@ -158,6 +158,12 @@ void UpdateClient::update() {
connection.close();
QPID_LOG(debug, updaterId << " update completed to " << updateeId
<< " at " << updateeUrl << ": " << membership);
+ // FIXME aconway 2010-03-15: This sleep avoids the race condition
+ // described in // https://bugzilla.redhat.com/show_bug.cgi?id=568831.
+ // It allows the connection to fully close before destroying the
+ // Connection object. Remove when the bug is fixed.
+ //
+ sys::usleep(10*1000); // 100ms
}
namespace {
diff --git a/qpid/cpp/src/tests/ClusterFixture.cpp b/qpid/cpp/src/tests/ClusterFixture.cpp
index fd90ed170e..b7e8e88abf 100644
--- a/qpid/cpp/src/tests/ClusterFixture.cpp
+++ b/qpid/cpp/src/tests/ClusterFixture.cpp
@@ -130,11 +130,11 @@ void ClusterFixture::kill(size_t n, int sig) {
forkedBrokers[n]->kill(sig);
}
-/** Kill a broker and suppressing errors from closing connection c. */
+/** Kill a broker and suppress errors from closing connection c. */
void ClusterFixture::killWithSilencer(size_t n, client::Connection& c, int sig) {
ScopedSuppressLogging sl;
- kill(n,sig);
try { c.close(); } catch(...) {}
+ kill(n,sig);
}
/**