Bug 785017

Summary: Queue Not Found exception thrown when creating a consumer due to the client using a binding for a previous subscriber
Product: Red Hat Enterprise MRG Reporter: Rajith Attapattu <rattapat+nobody>
Component: qpid-javaAssignee: Rajith Attapattu <rattapat+nobody>
Status: CLOSED CURRENTRELEASE QA Contact: ppecka <ppecka>
Severity: medium Docs Contact:
Priority: high    
Version: DevelopmentCC: freznice, iboverma, jross, ppecka
Target Milestone: 2.1.2   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-jca-0.14-6 Doc Type: Bug Fix
Doc Text:
Cause: The queue binding for a previous subscription is still present in the destination object. Consequence: This causes a Queue-Not-Found exception when trying to create the new subscription (and the old subscription queue is not there anymore). Fix: Queue binding for the subscription queue is issued explicitly instead of adding into the list of bindings. Result: You could now create multiple Topic subscriptions with the same destination without any errors.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-12-07 17:42:04 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Rajith Attapattu 2012-01-26 22:51:58 UTC
Description of problem:

If a Topic destination is used with another consumer a binding for the previous subscriber still exists. This is due to the code adding it to the binding list, but not removing it.
If the consumer finishes the subscription and this queue is deleted, then an exception will be thrown when a subsequent consumer tries to use this destination to create a subscriptions.

A solution to this problem is to issue the binding explicitly for the subscription queue and not add it to the bindings list.

Version-Release number of selected component (if applicable):
java rpms that support addressing.

How reproducible:
Always

Steps to Reproduce:
AMQConnection con = new AMQConnection("amqp://guest:guest@clientid/test?brokerlist='tcp://localhost:5672'");
con.start();
Session ssn = con.createSession(false,Session.AUTO_ACKNOWLEDGE);
Destination d = ssn.createTopic("amq.topic/test");
		
MessageConsumer cons1 = ssn.createConsumer(d);
cons1.close();
		((AMQSession_0_10)ssn).sendQueueDelete(((AMQDestination)d).getAMQQueueName());
((AMQSession_0_10)ssn).sync();
		
MessageConsumer cons2 = ssn.createConsumer(d);
  
Actual results:
Exception thrown. Ex,
Exception in thread "main" javax.jms.JMSException: Error registering consumer: org.apache.qpid.AMQException: ch=0 id=3 ExecutionException(errorCode=NOT_FOUND, commandId=15, classCode=7, commandCode=4, fieldIndex=0, description=not-found: Bind failed. No such queue: TempQueue63977b9c-0dd1-4159-b65a-fe388b035024 (qpid/broker/Broker.cpp:1041), errorInfo={}) [error code 404: not found]
	at org.apache.qpid.client.AMQSession$4.execute(AMQSession.java:2079)

Expected results:
The subscription should succeed.

Additional info:

Comment 1 Rajith Attapattu 2012-01-26 22:53:39 UTC
This issue is fixed upstream.
http://svn.apache.org/viewvc?rev=1236198&view=rev

Comment 2 Rajith Attapattu 2012-03-12 15:33:45 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause: The queue binding for a previous subscription is still present in the destination object.

Consequence: This causes a Queue-Not-Found exception when trying to create the new subscription (and the old subscription queue is not there anymore).

Fix: Queue binding for the subscription queue is issued explicitly instead of adding into the list of bindings. 

Result: You could now create multiple Topic subscriptions with the same destination without any errors.

Comment 3 ppecka 2012-03-26 13:26:44 UTC
Verified with simple JMS client (no jca involved) on RHEL5.8 / RHEL6.2 ( both x686, x86_64)

python-qpid-0.14-5.el6.noarch
python-qpid-qmf-0.14-4.el6.i686
qpid-cpp-client-0.14-10.el6.i686
qpid-cpp-client-devel-0.14-10.el6.i686
qpid-cpp-client-devel-docs-0.14-10.el6.noarch
qpid-cpp-server-0.14-10.el6.i686
qpid-cpp-server-cluster-0.14-10.el6.i686
qpid-cpp-server-devel-0.14-10.el6.i686
qpid-cpp-server-store-0.14-10.el6.i686
qpid-cpp-server-xml-0.14-10.el6.i686
qpid-java-client-0.14-3.el6.noarch
qpid-java-common-0.14-3.el6.noarch
qpid-java-example-0.14-3.el6.noarch
qpid-jca-0.14-9.el5.noarch
qpid-qmf-0.14-4.el6.i686
qpid-tools-0.14-1.el6.noarch