Bug 756804 - Empty exception not thrown when consuming from empty queue with c++ client
Summary: Empty exception not thrown when consuming from empty queue with c++ client
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: qpid-cpp
Version: 2.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 2.2
: ---
Assignee: messaging-bugs
QA Contact: MRG Quality Engineering
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-24 16:24 UTC by Petr Matousek
Modified: 2013-02-24 15:22 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-11-28 17:44:56 UTC
Target Upstream Version:


Attachments (Terms of Use)
cpp test reproducer (926 bytes, application/x-cpp)
2011-11-24 16:25 UTC, Petr Matousek
no flags Details
python test reproducer (435 bytes, application/x-python)
2011-11-24 16:26 UTC, Petr Matousek
no flags Details

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'


Note You need to log in before you can comment on or make changes to this bug.