From b7be5cd127c82f5bcd8836a3e534830bb9f8a59e Mon Sep 17 00:00:00 2001 From: Gordon Sim Date: Thu, 25 Apr 2013 12:28:23 +0000 Subject: QPID-4764: tweaks to locking in receiver and session to avoid deadlock git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1475723 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp | 11 ++++++++--- qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp | 2 -- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp b/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp index 11f9475cad..7e8de21247 100644 --- a/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp +++ b/qpid/cpp/src/qpid/client/amqp0_10/ReceiverImpl.cpp @@ -123,7 +123,6 @@ void ReceiverImpl::init(qpid::client::AsyncSession s, AddressResolution& resolve } const std::string& ReceiverImpl::getName() const { - sys::Mutex::ScopedLock l(lock); return destination; } @@ -200,9 +199,15 @@ void ReceiverImpl::closeImpl() if (state != CANCELLED) { state = CANCELLED; sync(session).messageStop(destination); - parent->releasePending(destination); + { + sys::Mutex::ScopedUnlock l(lock); + parent->releasePending(destination); + } source->cancel(session, destination); - parent->receiverCancelled(destination); + { + sys::Mutex::ScopedUnlock l(lock); + parent->receiverCancelled(destination); + } } } diff --git a/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp b/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp index be5eab1f2b..e4c2c6afb8 100644 --- a/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp +++ b/qpid/cpp/src/qpid/client/amqp0_10/SessionImpl.cpp @@ -471,13 +471,11 @@ void SessionImpl::rollbackImpl() void SessionImpl::acknowledgeImpl() { - ScopedLock l(lock); if (!transactional) incoming.accept(); } void SessionImpl::acknowledgeImpl(qpid::messaging::Message& m, bool cumulative) { - ScopedLock l(lock); if (!transactional) incoming.accept(MessageImplAccess::get(m).getInternalId(), cumulative); } -- cgit v1.2.1