Bug 997919

Summary: subscribing a consumer to a queue using filter/selector causes already subscribed consumers to stop receiving messages
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matousek <pematous>
Severity: high Docs Contact:
Priority: high    
Version: DevelopmentCC: esammons, gsim, iboverma, jross
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-12 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 12:56:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1010399    

Description Petr Matousek 2013-08-16 13:46:09 UTC
Description of problem:

Already subscribed consumer stops to receive messages when another subscription to the same queue with different subject is initiated. see 'Steps to Reproduce' for more details.

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

How reproducible:
100%

Steps to Reproduce:
1. create a shared queue 'q'
# drain --connection-options "{ protocol: 'amqp1.0' }" "q;{create:always}"
2. subscribe a cosumer1 to queue 'q' using filter 'a'
# drain -f --connection-options "{ protocol: 'amqp1.0' }" q/a
3. send several messages to towards queue 'q' with subject set to 'a'
# for i in $(seq 5); do ./spout --connection-options "{ protocol: 'amqp1.0' }" q/a; done
4. all the messages consumed by consumer1 as expected
5. subscribe cosumer2 to queue 'q' using different filter 'b'
# drain -f --connection-options "{ protocol: 'amqp1.0' }" q/b
6. repeat step 3
7. the consumer1 obtains only one message, then he stops to receive messages
8. the consumer2 may normally receive messages sent towards queue 'q' with subject set to 'b'
# spout --connection-options "{ protocol: 'amqp1.0' }" q/b
9. after the consumer1 restart, the consumer1 gets the rest of the messages (that he didn't received in step 7)

Actual results:
subscribing a consumer to a queue using filter causes already subscribed consumer to stop receive messages

Expected results:
Already subscribed consumer continues to receive messages after another consumer is subscribed using different filter 

Additional info:

terminal1 - publisher:
# ./drain --connection-options "{ protocol: 'amqp1.0' }" "q;{create:always}"
-- consumer1 has subscribed here --
# for i in $(seq 5); do ./spout --connection-options "{ protocol: 'amqp1.0' }" q/a; done
-- consumer2 has subscribed here --
# for i in $(seq 5); do ./spout --connection-options "{ protocol: 'amqp1.0' }" q/a; done
# for i in $(seq 5); do ./spout --connection-options "{ protocol: 'amqp1.0' }" q/b; done
-- consumer1 restart --

terminal2 - consumer1:
# ./drain -f --connection-options "{ protocol: 'amqp1.0' }" q/a
Message(properties={spout-id:0e05ac1c-6bee-4966-b1af-89efda0e1883:0}, content='')
Message(properties={spout-id:0e05ac1c-6bee-4966-b1af-89efda0e1883:0}, content='')
Message(properties={spout-id:0e05ac1c-6bee-4966-b1af-89efda0e1883:0}, content='')
Message(properties={spout-id:0e05ac1c-6bee-4966-b1af-89efda0e1883:0}, content='')
Message(properties={spout-id:0e05ac1c-6bee-4966-b1af-89efda0e1883:0}, content='')
-- consumer2 has subscribed here --
Message(properties={spout-id:0e05ac1c-6bee-4966-b1af-89efda0e1883:0}, content='')
-- consumer1 stopped to receive messages --
^C
# ./drain -f --connection-options "{ protocol: 'amqp1.0' }" q/a
Message(properties={spout-id:8ba06f2f-89f2-4604-b7b5-d8b211e435cb:0}, content='')
Message(properties={spout-id:8ba06f2f-89f2-4604-b7b5-d8b211e435cb:0}, content='')
Message(properties={spout-id:8ba06f2f-89f2-4604-b7b5-d8b211e435cb:0}, content='')
Message(properties={spout-id:8ba06f2f-89f2-4604-b7b5-d8b211e435cb:0}, content='')

terminal3 - consumer2:
# ./drain -f --connection-options "{ protocol: 'amqp1.0' }" q/b
Message(properties={spout-id:f1e5dfcf-281d-47b7-b91e-9d086cf37523:0}, content='')
Message(properties={spout-id:f1e5dfcf-281d-47b7-b91e-9d086cf37523:0}, content='')
Message(properties={spout-id:f1e5dfcf-281d-47b7-b91e-9d086cf37523:0}, content='')
Message(properties={spout-id:f1e5dfcf-281d-47b7-b91e-9d086cf37523:0}, content='')
Message(properties={spout-id:f1e5dfcf-281d-47b7-b91e-9d086cf37523:0}, content='')

Comment 1 Gordon Sim 2013-08-16 17:14:15 UTC
Note that this also affects selectors (over both 0-10 and 1.0). It is a side-effect of the filtering logic added to queues (hence the skip-errata flag, since this will not have been released in product yet).

Comment 2 Gordon Sim 2013-08-16 22:16:00 UTC
Fixed upstream: https://svn.apache.org/r1514907

Comment 3 Petr Matousek 2013-09-06 15:40:59 UTC
This issue has been fixed. Verified on rhel6.4 (i386,x86_64).

packages used for testing:
qpid-cpp-*-0.22-13.el6