Bug 756804

Summary: Empty exception not thrown when consuming from empty queue with c++ client
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: messaging-bugs <messaging-bugs>
Status: CLOSED NOTABUG QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 2.0CC: jross
Target Milestone: 2.2   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-11-28 17:44:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
cpp test reproducer
none
python test reproducer none

Description Petr Matousek 2011-11-24 16:24:34 UTC
Description of problem:

No exception is thrown when consuming messages from empty queue with c++ client.
EMPTY exception is thrown when python client is used.

If you assume that the c++ client behaviour is correct, feel free to change the component to python-qpid.

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

How reproducible:
python-qpid-0.10-1.el5
python-qpid-qmf-0.10-10.el5
qpid-cpp-client-0.10-9.el5
qpid-cpp-client-devel-0.10-9.el5
qpid-cpp-client-devel-docs-0.10-9.el5
qpid-cpp-client-ssl-0.10-9.el5
qpid-cpp-server-0.10-9.el5
qpid-cpp-server-cluster-0.10-9.el5
qpid-cpp-server-devel-0.10-9.el5
qpid-cpp-server-ssl-0.10-9.el5
qpid-cpp-server-store-0.10-9.el5
qpid-cpp-server-xml-0.10-9.el5
qpid-java-client-0.10-9.el5
qpid-java-common-0.10-9.el5
qpid-java-example-0.10-9.el5
qpid-qmf-0.10-10.el5
qpid-qmf-devel-0.10-10.el5
qpid-tools-0.10-6.el5

This issue is also valid on latest 0.12 packages

Steps to Reproduce:
1. run the test reproducers
  
Actual results:
No exception thrown when consuming messages from empty queue with c++ client

Expected results:
Empty exception thrown when consuming messages from empty queue with c++ client

Additional info:

example test reproducer output:

c++:
No exception caught while consuming from empty queue

python:
Traceback (most recent call last):
  File "./empty.py", line 14, in ?
    m = receiver.fetch(0)
  File "<string>", line 6, in fetch
  File "/usr/lib/python2.4/site-packages/qpid/messaging/endpoints.py", line 1014, in fetch
    raise Empty()
Empty: None

Comment 1 Petr Matousek 2011-11-24 16:25:54 UTC
Created attachment 535968 [details]
cpp test reproducer

Comment 2 Petr Matousek 2011-11-24 16:26:33 UTC
Created attachment 535970 [details]
python test reproducer

Comment 3 Gordon Sim 2011-11-24 16:36:27 UTC
There are two versions of the Receiver::fetch() method in the C++ API. The one used here returns a boolean value to indicate whether or not there was a message (true indicates a message was fetched, false indicates there was no message to fetch). The other form of the method returns the message and throws an exception if there wasn't one to fetch.

Comment 4 Petr Matousek 2011-11-24 16:49:37 UTC
Double checked, following change invokes the expected behaviour (empty exception is thrown):

- receiver.fetch(m, timeout);
+ m = receiver.fetch(timeout);

So this issue can be probably closed as 'NOTABUG'