Bug 772028

Summary: malfunctioning unsettled() receiver method
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: python-qpidAssignee: Ernie <eallen>
Status: CLOSED ERRATA QA Contact: Chuck Rolke <crolke>
Severity: high Docs Contact:
Priority: high    
Version: DevelopmentCC: crolke, freznice, jross, lzhaldyb
Target Milestone: 3.0Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-qpid-0.22-3.el6, python-qpid-0.22-2.el5 Doc Type: Bug Fix
Doc Text:
It was discovered that the python messaging method `receiver.unsettled()` referenced a non-existent "acked" variable. Calling `receiver.unsettled()` raised an exception. The fix now uses `session.acked` instead of `receiver.acked`, which ensures the correct number of unsettled messages are returned.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-24 15:03:46 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
Uses session.acked list to determine the number of acknowledged messages awaiting confirmation
none
Adds a testUnsettled to the receiver tests
none
shell reproducer none

Description Petr Matousek 2012-01-05 17:14:49 UTC
Description of problem:

following error is displayed when the method is called:

Traceback (most recent call last):
  File "./default_capacity.py", line 9, in ?
    receiver.unsettled()
  File "<string>", line 6, in unsettled
  File "/usr/lib/python2.4/site-packages/qpid/messaging/endpoints.py", line 974, in unsettled
    return len([m for m in self.acked if m._receiver is self])
AttributeError: 'Receiver' object has no attribute 'acked'

Version-Release number of selected component (if applicable):
python-qpid-0.14-1.el5

How reproducible:
100%

Steps to Reproduce:
simple reproducer:

from qpid.messaging import *

connection = Connection("localhost:5672")
connection.open()
session = connection.session()
receiver = session.receiver("q;{create:receiver,delete:receiver}")
print receiver.unsettled()
connection.close()
  
Actual results:
An error occurs by calling receiver unsettled() method

Expected results:
No error occurs, a count of the number of messages received on this receiver that have been acknowledged, but for which that acknowledgement has not yet been confirmed as processed by the server is returned by this method. 

Additional info:

Comment 1 Ernie 2013-03-22 13:58:39 UTC
Created attachment 714553 [details]
Uses session.acked list to determine the number of acknowledged messages awaiting confirmation

It appears the intent was to count the number of acked messages in the session's acked list (that are 'owned' by the receiver).

Comment 2 Justin Ross 2013-04-18 14:09:48 UTC
Ernie, I can't pull this one in until it has a test.

Comment 3 Ernie 2013-04-19 16:31:14 UTC
Created attachment 737696 [details]
Adds a testUnsettled to the receiver tests

This just tests the code path and not the validity of the return value.

Comment 4 Justin Ross 2013-04-23 21:30:35 UTC
-> POST

http://svn.apache.org/viewvc?view=revision&revision=1471150

Comment 5 Chuck Rolke 2013-07-10 19:46:41 UTC
Created attachment 771817 [details]
shell reproducer

shell reproducer (cloned from bz964189) using several QA hooks for determining success/failure. This could be used for automated or manual tests.

1. Starts a fresh broker
2. Emits a python script
3. Executes python script and extracts exit status from it
4. Exits with standard error format

Comment 6 Chuck Rolke 2013-07-11 19:56:07 UTC
This bug also has a reproducer built-in to the normal system tests and does not need QA special treatment.
This bug is verified manually on the systems listed below.

System:
2.6.32-358.el6.x86_64
Packages: -----------------------------[begin]
python-qpid-0.22-4.el6.noarch
python-qpid-qmf-0.22-5.el6.x86_64
qpid-cpp-client-0.22-6.el6.x86_64
qpid-cpp-client-devel-0.22-6.el6.x86_64
qpid-cpp-server-0.22-6.el6.x86_64
qpid-proton-c-0.4-2.2.el6.x86_64
qpid-proton-c-devel-0.4-2.2.el6.x86_64
qpid-qmf-0.22-5.el6.x86_64
qpid-tools-0.22-3.el6.noarch
Packages: -------------------------------[end]

System:
2.6.32-358.el6.i686
Packages: -----------------------------[begin]
python-qpid-0.22-4.el6.noarch
python-qpid-qmf-0.22-5.el6.i686
qpid-cpp-client-0.22-6.el6.i686
qpid-cpp-client-devel-0.22-6.el6.i686
qpid-cpp-server-0.22-6.el6.i686
qpid-proton-c-0.4-2.2.el6.i686
qpid-proton-c-devel-0.4-2.2.el6.i686
qpid-qmf-0.22-5.el6.i686
qpid-tools-0.22-3.el6.noarch
Packages: -------------------------------[end]

System:
2.6.18-348.el5PAE
Packages: -----------------------------[begin]
python-qpid-0.22-4.el5
python-qpid-qmf-0.22-5.el5
qpid-cpp-client-0.22-6.el5
qpid-cpp-client-devel-0.22-6.el5
qpid-cpp-server-0.22-6.el5
qpid-proton-c-0.4-2.2.el5
qpid-proton-c-devel-0.4-2.2.el5
qpid-qmf-0.22-5.el5
qpid-tools-0.22-2.el5
Packages: -------------------------------[end]

System:
2.6.18-348.6.1.el5
Packages: -----------------------------[begin]
python-qpid-0.22-4.el5
python-qpid-qmf-0.22-5.el5
qpid-cpp-client-0.22-6.el5
qpid-cpp-client-devel-0.22-6.el5
qpid-cpp-server-0.22-6.el5
qpid-java-client-0.22-2.el5
qpid-java-common-0.22-2.el5
qpid-java-example-0.22-2.el5
qpid-proton-c-0.4-2.2.el5
qpid-proton-c-devel-0.4-2.2.el5
qpid-qmf-0.22-5.el5
qpid-tools-0.22-2.el5
Packages: -------------------------------[end]

Comment 9 errata-xmlrpc 2014-09-24 15:03:46 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