Incorrect logic for handling message credits in BasicMessageConsumer_0_10  
could result in the client receiving more messages than it needs.
--------------------------------------------------------------------------------------------------------------------------------------------

                 Key: QPID-2604
                 URL: https://issues.apache.org/jira/browse/QPID-2604
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: 0.6, 0.5, M4
            Reporter: Rajith Attapattu
            Assignee: Rajith Attapattu
             Fix For: 0.7


In getMessageFromQueue method in BasicMessageConsumer_0_10, 
If there no messages in the local queue, it will call messageFlush and then 
sync. 
This is to ensure we get any messages that are in flight before we return null  
if we don't get any.

However once we do a messageFlush the broker will clear the credits. 
So we immediately issue more credits. However we are not talking into account 
any unacked messages, therefore we will issue more credits than intended.

This can be easily observed when using CLIENT-ACK.
1. Send 30 messages to a queue
2. Create a consumer on the queue and set prefetch=10
3. Consume 10 messages without acking any.
4. Try to receive the 11th message, and observe in the logs that the broker has 
sent 10 more messages bcos of the above error.
5.  Continue to receive messages until the 20th without acking.
6. Try to receive the 21st message, and observe in the logs that the broker has 
sent 10 more messages bcos of the above error.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:[email protected]

Reply via email to