[
https://issues.apache.org/jira/browse/QPID-2604?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rajith Attapattu updated QPID-2604:
-----------------------------------
Description:
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 messages-transfers that we haven't marked completed, therefore we will
issue more credits than intended when these message-transfers are marked as
complete.
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.
* It's important to note here that the client marks completions during the
acking process. Therefore if we don't ack, then we don't mark messages as
completed.
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.
was:
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.
> 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: M4, 0.5, 0.6
> Reporter: Rajith Attapattu
> Assignee: Rajith Attapattu
>
> 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 messages-transfers that we haven't marked completed, therefore we will
> issue more credits than intended when these message-transfers are marked as
> complete.
> 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.
> * It's important to note here that the client marks completions during the
> acking process. Therefore if we don't ack, then we don't mark messages as
> completed.
> 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.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project: http://qpid.apache.org
Use/Interact: mailto:[email protected]