Bug 703891

Summary: Deadlock when multiple threads concurrently operate on the same receiver
Product: Red Hat Enterprise MRG Reporter: Jason Dillaman <jdillama>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED ERRATA QA Contact: mick <mgoulish>
Severity: high Docs Contact:
Priority: high    
Version: 1.3CC: gsim, iboverma, jross, lzhaldyb, mgoulish
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-4.el6, qpid-cpp-0.22-4.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-24 15:02:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 698367, 803771    
Attachments:
Description Flags
Deadlock Backtrace
none
3-thread reproducer : threads ack, fetch, and close, with random jitter none

Description Jason Dillaman 2011-05-11 14:52:22 UTC
Created attachment 498309 [details]
Deadlock Backtrace

Description of problem:
Multiple threads are performing various operations on a single QPID receiver at the same time.  One thread is acknowledging a previously received message, another thread is getting the next message from the receiver, and the third thread is attempting to close the receiver.

Version-Release number of selected component (if applicable):
qpid-cpp-client-0.7.946106-28_ptc_hotfix_5_v2.el5

How reproducible:
100% when the above conditions are met

Steps to Reproduce:
1. 1st thread acks a message from a given receiver
2. 2nd thread is fetching the next message from the given receiver
3. 3rd thread is attempting to close the receiver
  
Actual results:
The three threads become deadlocks.  Thread 1 holds SessionImpl's lock and is blocked on IncomingMessage's lock.  Thread 2 holds IncomingMessage's lock and is blocked on ReceiverImpl's lock.  Thread 3 holds the ReceiverImpl's lock and is blocked on SessionImpl's lock. 

Expected results:
No deadlock and the receiver is closed.

Additional info:
See attached backtrace

Comment 1 Gordon Sim 2013-04-25 12:30:01 UTC
Fix committed as http://svn.apache.org/viewvc?view=revision&revision=1475723 that should break this deadlock. Note that I was unable to reproduce it however.

Comment 2 mick 2013-07-18 18:34:00 UTC
Created attachment 775458 [details]
3-thread reproducer :  threads ack, fetch, and close, with random jitter

Please see comment at top of code in this attachment.

Comment 3 mick 2013-07-18 18:35:37 UTC
I have been unable to repro this bug after more than 21,000 iterations of my reproducer (see attached.)  so I am calling it verified.

Comment 4 mick 2013-07-19 14:20:07 UTC
Post Scriptum
-------------------------

I finally stopped my reproducer-attempt at 45,000 iterations, with no joy.

Comment 5 errata-xmlrpc 2014-09-24 15:02:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1296.html