Bug 1045092

Summary: [amqp1.0] don't increment the delivery count for prefetched message not delivered to application
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED CURRENTRELEASE QA Contact: Irina Boverman <iboverma>
Severity: medium Docs Contact:
Priority: medium    
Version: DevelopmentCC: esammons, gsim, iboverma, jross
Target Milestone: 3.0Keywords: OtherQA
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-35 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1081162 (view as bug list) Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1081162    

Description Petr Matousek 2013-12-19 15:12:42 UTC
Description of problem:

The delivery count for receiver's prefetched messages is increased even if the messages was not seen by the application.

# qpid-send --messages 3 --address "q;{create:sender}"
# qpid-receive --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q
Properties: {sn:1, ts:1387456209158654200}
# qpid-receive --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q
Redelivered: true
Properties: {sn:2, ts:1387456209158736790, x-amqp-delivery-count:1}

The redelivered flag is set to true and x-amqp-delivery-count is increased

When the capacity is set to be 0, the behavior is as expected:

# qpid-send --messages 10 --address "q;{create:sender}"
# qpid-receive --capacity 0 --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q
Properties: {sn:1, ts:1387463670006783616}
# qpid-receive --capacity 0 --connection-options {protocol:amqp1.0} --print-headers true --messages 1 --address q
Properties: {sn:2, ts:1387463670006894302}

Version-Release number of selected component (if applicable):
qpid-cpp-*-0.22-29

How reproducible:
100%

Steps to Reproduce:
1. send a message using qpid-send (use default capacity)
2. receive single message
3. receive next message
4. the message is marked as redelivered and x-amqp-delivery-count is increased

Actual results:
Delivery count increased and redelivered flag set for prefetched messages

Expected results:
Messages that was not seen by the application shall not be marked redelivered and the delivery caount shall not be increased.

Additional info:

Not exactly sure what shall be the correct behavior here, feel free to change to doc bug when this issue will be identified as correct behavior.

See bug 975422, comment 2

Comment 1 Gordon Sim 2014-01-23 16:08:50 UTC
Fixed upstream: https://svn.apache.org/r1560718

Now, when a receiver is closed, any prefetched messages - those delivered to the client by the broker that have not been returned to the application - will be released, which prevents the delivery count being incremented.