summaryrefslogtreecommitdiff
path: root/cpp/src
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
commit7cfc47a836ac1f92a80f37acedd048ec3dd19b4e (patch)
tree0bbc8f0d1ffe8eddbc09d8146e54ba6d4aa93c04 /cpp/src
parent34e71040bd3d94549d6ad100db2e7f481e840cbe (diff)
downloadqpid-python-7cfc47a836ac1f92a80f37acedd048ec3dd19b4e.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/qpid@1087047 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp b/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp
index 454ce62495..3d868da64b 100644
--- a/cpp/src/qpid/sys/cyrus/CyrusSecurityLayer.cpp
+++ b/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)