summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Goulish <mgoulish@apache.org>2011-03-30 19:11:09 +0000
committerMichael Goulish <mgoulish@apache.org>2011-03-30 19:11:09 +0000
commitcfbe48cd9b8432600864e89465c321020a8940cd (patch)
tree3438ae6f8798e76d2ec2f3ba99d185ab8106ec7c
parent49d7dad9c00ff89ebfb61c5ce66c2e4300ccd846 (diff)
downloadqpid-python-cfbe48cd9b8432600864e89465c321020a8940cd.tar.gz
qpid-3171
The registration of the codec happens on a different thread from the use of the codec. It is possible for the registration to occur after the first attempted use. In my testing, this happened 3% of the time -- 165 times out of 5000 tests -- when using RDMA transport, and 0 times out of 5000 when using TCP. Which is why we didn't notice it earlier. We have a function that tells when we are ready to encode -- CyrusSecurityLayer::canEncode. But it does not check the validity of the codec pointer before using it, so it cores in this situation. I believe simply checking that pointer is probably the best solution. Introducing that check caused the crash not to show up in 10,000 trials. There were also no hangs. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1087047 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp b/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp
index 454ce62495..3d868da64b 100644
--- a/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp
+++ b/qpid/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp
@@ -106,7 +106,7 @@ size_t CyrusSecurityLayer::encode(const char* buffer, size_t size)
bool CyrusSecurityLayer::canEncode()
{
- return encrypted || codec->canEncode();
+ return codec && (encrypted || codec->canEncode());
}
void CyrusSecurityLayer::init(qpid::sys::Codec* c)