Bug 755639

Summary: timeout parameter in sender send() method is ignored if the queue is in PFC active state
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: python-qpidAssignee: messaging-bugs <messaging-bugs>
Status: NEW --- QA Contact: MRG Quality Engineering <mrgqe-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 2.0CC: jross, kgiusti
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 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
simple test reproducer none

Description Petr Matousek 2011-11-21 16:45:32 UTC
Description of problem:

Specified 'timeout' parameter is ignored by send() method of the sender if a queue is PFC active state. Sender is blocked in send() method until several messages are dequeued (PFC deactivated) regardless specified timeout. 

This could probably cause an application hang, i.e. if all consumers dies

This issue is valid on latest packages (0.12-6) as well

Version-Release number of selected component (if applicable):
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

How reproducible:
100%

Steps to Reproduce:
1. qpidd running with default PFC rules (threshold 80%)
2. run the test reproducer
3. sender is blocked by PFC on sending message number 9
4. the sender is blocked until some messages are consumed even if the timeout was specified for the send() method
  
Actual results:
send() method of the sender will never timeout even if the 'timeout' parameter was defined

Expected results:
send() method of the sender will timeout after defined interval

Additional info:

Comment 1 Petr Matousek 2011-11-21 16:47:55 UTC
Created attachment 534823 [details]
simple test reproducer

Comment 2 Ken Giusti 2011-11-21 22:03:15 UTC
The timeout parameter to send() is ignored by the python client if capacity is set to unlimited (as it is in the reproducer - unlimited is the default).  According to the documentation, this is by design.

HOWEVER, If I change the reproducer to set a capacity value, such as:

  sender = session.sender("q;{create:sender,delete:receiver, node: {x-declare:{arguments:{'qpid.max_count':10}}}}",
                          capacity=1)

The python client is still ignoring the timeout parameter.  In endpoints.py:

    if self.capacity is not UNLIMITED:
      print("CAPACITY=%s" % self.capacity)
      if self.capacity <= 0:
        raise InsufficientCapacity("capacity = %s" % self.capacity)
      print("AVAILABLE=%s" % self.available())
      if not self._ecwait(self.available, timeout=timeout):
        raise InsufficientCapacity("capacity = %s" % self.capacity)

The code that computes self.available() always returns '1', indicating capacity available, and the timeout is not used.

Not sure if this is correct, as the C++ client does not support a "timeout" parameter in its send so I cannot check the behavior.