Bug 1128654

Summary: nextReceiver() with IMMEDIATE duration always returns null
Product: Red Hat Enterprise MRG Reporter: Gordon Sim <gsim>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED ERRATA QA Contact: Zdenek Kraus <zkraus>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 2.4CC: esammons, gsim, jross, lzhaldyb, mcressma, messaging-qe-bugs, pmoravec, zkraus
Target Milestone: 2.5.5   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.18-29 Doc Type: Bug Fix
Doc Text:
It was discovered that calling Session::nextReceiver() with a duration of IMMEDIATE always returned null, even if there were incoming messages waiting. This bug, introduced as part of the fix for bug 958895 in the 2.3.3 release, resulted in incoming messages never being received. The fix allows for messages to be returned even if there is no waiting period. Messages are now properly delivered.
Story Points: ---
Clone Of: 1128653 Environment:
Last Closed: 2014-10-22 16:34:21 UTC Type: Bug
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: 1128653    
Bug Blocks: 1140368, 1140369    

Description Gordon Sim 2014-08-11 10:04:08 UTC
+++ This bug was initially created as a clone of Bug #1128653 +++

Description of problem:

Calling Session::nextReceiver() with a duration of IMMEDIATE will always return null, even if there are incoming messages waiting. This bug was introduced as part of the fix for bug 958895.

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

qpid-0.24, mrg 2.3.3, qpid-0.28

How reproducible:

Easily

Steps to Reproduce:
1. put some messages in a queue
2. have a program that creates a receiver for the queue, sets a non-zero capacity, then loops until nextReceiver(Duration::IMMEDIATE returns a non-null receiver), e.g.:

   ssn.createReceiver("my-queue").setCapacity(1);
   Receiver next;
   while (ssn.nextReceiver(next, Duration::IMMEDIATE)) {}
   next.get(Duration::IMMEDIATE);


Actual results:

The while loop never returns, even though there are messages on the queue

Expected results:

The while loop exits once the broker has sent out (a) message(s)

Additional info:

It should be pointed out that using nextReceiver() with a Duration::IMMEDIATE value in this way is inefficient and rather odd. A much better solution would be to specify some non-zero timeout. This would avoid the cpu usage of a 'busy wait' while in no way either increasing the actual time until the next receiver is obtained or the maximum theoretical time.

Using nextReceiver() with a non-zero timeout also avoids this bug.

Comment 2 Gordon Sim 2014-08-11 11:28:44 UTC
Fixed upstream: https://svn.apache.org/r1617256

Comment 4 Gordon Sim 2014-08-14 12:50:22 UTC
The commit above fixes one regression but introduces another. Need https://svn.apache.org/r1617924 also from upstream.

Comment 8 Zdenek Kraus 2014-09-23 17:19:19 UTC
Tested on RHEL6 RHEL5 i686 x86_64, with following packages:
qpid-cpp-client-0.18-32
qpid-cpp-client-devel-0.18-32
qpid-cpp-client-devel-docs-0.18-32
qpid-cpp-client-ssl-0.18-32
qpid-cpp-server-0.18-32
qpid-cpp-server-devel-0.18-32
qpid-cpp-server-ssl-0.18-32
qpid-cpp-server-store-0.18-32
qpid-cpp-server-xml-0.18-32

->VERIFIED

Comment 10 errata-xmlrpc 2014-10-22 16:34:21 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.

https://rhn.redhat.com/errata/RHBA-2014-1682.html