Bug 612285

Summary: Thread safety issue - Session::createSender hangs when another thread calls nextReceiver
Product: Red Hat Enterprise Linux 6 Reporter: Ted Ross <tross>
Component: qpid-cppAssignee: Kim van der Riet <kim.vdriet>
Status: CLOSED CURRENTRELEASE QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.0CC: bche, gsim, jneedle, tross
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: qpid-cpp-0.7.946106-4 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 611847 Environment:
Last Closed: 2010-11-10 21:27:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 611847    
Bug Blocks:    

Description Ted Ross 2010-07-07 18:50:22 UTC
+++ This bug was initially created as a clone of Bug #611847 +++

Description of problem:

In a multi-threaded test where one thread loops on Session::nextReceiver and another calls Session::createSender, the call to createSender hangs.

Version-Release number of selected component (if applicable):

RHEL6 snapshot 7

How reproducible:

100%

--- Additional comment from tross on 2010-07-06 12:39:36 EDT ---

pstack output from hanging process:

$ pstack 7602
Thread 3 (Thread 0x7fe5f5ff2910 (LWP 7603)):
#0  0x000000334f6de868 in epoll_wait () from /lib64/libc.so.6
#1  0x00007fe5f6e33fca in qpid::sys::Poller::wait(qpid::sys::Duration) ()
#2  0x00007fe5f6e34639 in qpid::sys::Poller::run() ()
#3  0x00007fe5f6e2aeba in qpid::sys::(anonymous namespace)::runRunnable(void*)
#4  0x000000335020685a in start_thread () from /lib64/libpthread.so.0
#5  0x000000334f6de22d in clone () from /lib64/libc.so.6
#6  0x0000000000000000 in ?? ()
Thread 2 (Thread 0x7fe5effff910 (LWP 7604)):
#0  0x000000335020b54d in pthread_cond_timedwait@@GLIBC_2.3.2 ()
#1  0x00007fe5f791a5d9 in qpid::sys::Condition::wait(qpid::sys::Mutex&, qpid::sys::AbsTime const&) ()
#2  0x00007fe5f791aa6d in qpid::sys::BlockingQueue<boost::shared_ptr<qpid::framing::FrameSet> >::pop(boost::shared_ptr<qpid::framing::FrameSet>&, qpid::sys::Duration) () from /home/ross/svn/qpid/build-vpath/src/.libs/libqpidmessaging.so.2
#3  0x00007fe5f7917ed8 in qpid::client::amqp0_10::IncomingMessages::wait(qpid::sys::Duration) ()
#4  0x00007fe5f791833b in qpid::client::amqp0_10::IncomingMessages::getNextDestination(std::string&, qpid::sys::Duration) ()
#5  0x00007fe5f7921014 in qpid::client::amqp0_10::SessionImpl::nextReceiver(qpid::messaging::Receiver&, qpid::messaging::Duration) ()
#6  0x00007fe5f76ac94e in qmf::AgentSessionImpl::run() ()
#7  0x00007fe5f6e2aeba in qpid::sys::(anonymous namespace)::runRunnable(void*)
#8  0x000000335020685a in start_thread () from /lib64/libpthread.so.0
#9  0x000000334f6de22d in clone () from /lib64/libc.so.6
#10 0x0000000000000000 in ?? ()
Thread 1 (Thread 0x7fe5f5ff3790 (LWP 7602)):
#0  0x000000335020d944 in __lll_lock_wait () from /lib64/libpthread.so.0
#1  0x0000003350208ff0 in _L_lock_1017 () from /lib64/libpthread.so.0
#2  0x0000003350208e51 in pthread_mutex_lock () from /lib64/libpthread.so.0
#3  0x00007fe5f7921d18 in qpid::client::amqp0_10::SessionImpl::createSenderImpl(qpid::messaging::Address const&) ()
#4  0x00007fe5f7929b20 in bool qpid::client::amqp0_10::SessionImpl::execute<qpid::client::amqp0_10::SessionImpl::CreateSender>(qpid::client::amqp0_10::SessionImpl::CreateSender&) ()
#5  0x00007fe5f792214b in qpid::client::amqp0_10::SessionImpl::createSender(qpid::messaging::Address const&) ()
#6  0x00007fe5f78ffc50 in qpid::messaging::Session::createSender(std::string const&) () from /home/ross/svn/qpid/build-vpath/src/.libs/libqpidmessaging.so.2
#7  0x00007fe5f76ae508 in qmf::AgentSessionImpl::sendHeartbeat() ()
#8  0x00007fe5f76af92f in qmf::AgentSessionImpl::open() ()
#9  0x0000000000401652 in main ()

--- Additional comment from gsim on 2010-07-07 04:56:34 EDT ---

Fixed on trunk (r960951) and in release repo (http://mrg1.lab.bos.redhat.com/git/?p=qpid.git;a=commitdiff;h=22397fbf439ed2d7f61fa50a85439e3998771fdd).

Comment 3 Kim van der Riet 2010-07-15 11:21:41 UTC
Fixed in build qpid-cpp-0.7.946106-4.

Comment 5 releng-rhel@redhat.com 2010-11-10 21:27:48 UTC
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.