Description of problem: Qpid java client does not delete address when address requests it. Following pair of commands: ./run_example.sh org.apache.qpid.example.Spout --content=__c__ "Q; {create: sender}" ./run_example.sh org.apache.qpid.example.Drain "Q; {delete: receiver}" should do following actions: a] create the queue Q b] send the message the address Q c] receive the message d] clean up == delete the queue Q. Actions a] ... c] are done, but action d] is not done. Version-Release number of selected component (if applicable): python-qpid-0.7.946106-15.el5 qpid-cpp-client-0.7.946106-27.el5 qpid-cpp-client-devel-0.7.946106-27.el5 qpid-cpp-client-devel-docs-0.7.946106-27.el5 qpid-cpp-client-ssl-0.7.946106-27.el5 qpid-cpp-mrg-debuginfo-0.7.946106-27.el5 qpid-cpp-server-0.7.946106-27.el5 qpid-cpp-server-cluster-0.7.946106-27.el5 qpid-cpp-server-devel-0.7.946106-27.el5 qpid-cpp-server-ssl-0.7.946106-27.el5 qpid-cpp-server-store-0.7.946106-27.el5 qpid-cpp-server-xml-0.7.946106-27.el5 qpid-java-client-0.7.946106-14.el5 qpid-java-common-0.7.946106-14.el5 qpid-java-example-0.7.946106-14.el5 qpid-tools-0.7.946106-12.el5 How reproducible: 100%, across all supported RHEL variants Steps to Reproduce: 1. ./run_example.sh org.apache.qpid.example.Spout --content=__c__ "Q; {create: sender}" 2. ./run_example.sh org.apache.qpid.example.Drain "Q; {delete: receiver}" 3. qpid-config queues | grep Q Actual results: Address (queue) Q is not deleted when requested by "Q; {delete: receiver}" address passed to receiver client. Expected results: Address (queue) Q should be deleted when requested by "Q; {delete: receiver}" address passed to receiver client. Additional info (transcript): [root@dhcp-27-225 bz656488]# cd /usr/share/doc/qpid-java-0.7.946106/examples [root@dhcp-27-225 examples]# function addr_creation_deletion () > { > > addr="$1" > qpid-config queues | grep ${addr} > ./run_example.sh org.apache.qpid.example.Spout --content=__c__ "${addr}; {create: sender}" > echo $? > qpid-config queues | grep ${addr} > ./run_example.sh org.apache.qpid.example.Drain "${addr}; {delete: receiver}" > echo $? > qpid-config queues | grep ${addr} > > } [root@dhcp-27-225 examples]# addr_creation_deletion rand_addr_09r {content=__c__} Jan 25, 2011 1:05:50 PM org.apache.qpid.client.AMQConnection <init> INFO: Connection:amqp://guest:********@test/test?brokerlist='tcp://localhost:5672' Jan 25, 2011 1:05:50 PM org.apache.qpid.client.protocol.AMQProtocolSession <init> INFO: Using ProtocolVersion for Session:0-10 Jan 25, 2011 1:05:50 PM org.apache.qpid.client.handler.ClientMethodDispatcherImpl newMethodDispatcher INFO: New Method Dispatcher:AMQProtocolSession[null] Jan 25, 2011 1:05:50 PM org.apache.qpid.client.AMQConnection <init> INFO: Connecting with ProtocolHandler Version:0-10 Jan 25, 2011 1:05:51 PM org.apache.qpid.client.AMQConnection <init> INFO: Connected with ProtocolHandler Version:0-10 Jan 25, 2011 1:05:52 PM org.apache.qpid.client.AMQSession <init> INFO: Created session:org.apache.qpid.client.AMQSession_0_10@4aeaf40c Jan 25, 2011 1:05:52 PM org.apache.qpid.client.BasicMessageProducer setPublishMode INFO: MessageProducer org.apache.qpid.client.BasicMessageProducer_0_10@3c3ac93e using publish mode : ASYNC_PUBLISH_ALL ------------- Msg ------------- Body: __c__ JMS Correlation ID: null JMS timestamp: 1295957152187 JMS expiration: 0 JMS priority: 4 JMS delivery mode: 2 JMS reply to: null JMS Redelivered: false JMS Destination: 'rand_addr_09r'/None; { 'create': 'sender' } JMS Type: null JMS MessageID: ID:0bbaa074-bb7e-38ff-a60d-5474435afbf0 JMS Content-Type: text/plain AMQ message number: -1 Properties:<NONE> ------------------------------- Jan 25, 2011 1:05:52 PM org.apache.qpid.client.AMQSession close INFO: Closing session: org.apache.qpid.client.AMQSession_0_10@4aeaf40c 0 rand_addr_09r {} Jan 25, 2011 1:05:56 PM org.apache.qpid.client.AMQConnection <init> INFO: Connection:amqp://guest:********@test/test?brokerlist='tcp://localhost:5672' Jan 25, 2011 1:05:56 PM org.apache.qpid.client.protocol.AMQProtocolSession <init> INFO: Using ProtocolVersion for Session:0-10 Jan 25, 2011 1:05:56 PM org.apache.qpid.client.handler.ClientMethodDispatcherImpl newMethodDispatcher INFO: New Method Dispatcher:AMQProtocolSession[null] Jan 25, 2011 1:05:56 PM org.apache.qpid.client.AMQConnection <init> INFO: Connecting with ProtocolHandler Version:0-10 Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQConnection <init> INFO: Connected with ProtocolHandler Version:0-10 Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQSession <init> INFO: Created session:org.apache.qpid.client.AMQSession_0_10@4aeaf40c Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQSession registerConsumer INFO: Prefetching delayed existing messages will not flow until requested via receive*() or setML(). Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQSession startDispatcherIfNecessary INFO: Dispatcher-Channel-1 created Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQSession$Dispatcher run INFO: Dispatcher-Channel-1 started ------------- Msg ------------- Body: __c__ JMS Correlation ID: null JMS timestamp: 1295957152187 JMS expiration: 0 JMS priority: 4 JMS delivery mode: 2 JMS reply to: null JMS Redelivered: false JMS Destination: :///rand_addr_09r/rand_addr_09r?routingkey='rand_addr_09r' JMS Type: null JMS MessageID: ID:0bbaa074-bb7e-38ff-a60d-5474435afbf0 JMS Content-Type: text/plain AMQ message number: 2 Properties:<NONE> ------------------------------- Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQSession close INFO: Closing session: org.apache.qpid.client.AMQSession_0_10@4aeaf40c Jan 25, 2011 1:05:57 PM org.apache.qpid.client.BasicMessageConsumer close INFO: Closing consumer:1[1652180105] Jan 25, 2011 1:05:57 PM org.apache.qpid.client.AMQSession$Dispatcher run INFO: Dispatcher-Channel-1 thread terminating for channel 1:org.apache.qpid.client.AMQSession_0_10@4aeaf40c 0 rand_addr_09r [root@dhcp-27-225 examples]# addr_creation_deletion XXD {content=__c__} Jan 25, 2011 1:07:56 PM org.apache.qpid.client.AMQConnection <init> INFO: Connection:amqp://guest:********@test/test?brokerlist='tcp://localhost:5672' Jan 25, 2011 1:07:56 PM org.apache.qpid.client.protocol.AMQProtocolSession <init> INFO: Using ProtocolVersion for Session:0-10 Jan 25, 2011 1:07:56 PM org.apache.qpid.client.handler.ClientMethodDispatcherImpl newMethodDispatcher INFO: New Method Dispatcher:AMQProtocolSession[null] Jan 25, 2011 1:07:56 PM org.apache.qpid.client.AMQConnection <init> INFO: Connecting with ProtocolHandler Version:0-10 Jan 25, 2011 1:07:56 PM org.apache.qpid.client.AMQConnection <init> INFO: Connected with ProtocolHandler Version:0-10 Jan 25, 2011 1:07:57 PM org.apache.qpid.client.AMQSession <init> INFO: Created session:org.apache.qpid.client.AMQSession_0_10@4aeaf40c Jan 25, 2011 1:07:57 PM org.apache.qpid.client.BasicMessageProducer setPublishMode INFO: MessageProducer org.apache.qpid.client.BasicMessageProducer_0_10@3c3ac93e using publish mode : ASYNC_PUBLISH_ALL ------------- Msg ------------- Body: __c__ JMS Correlation ID: null JMS timestamp: 1295957277230 JMS expiration: 0 JMS priority: 4 JMS delivery mode: 2 JMS reply to: null JMS Redelivered: false JMS Destination: 'XXD'/None; { 'create': 'sender' } JMS Type: null JMS MessageID: ID:f8b55c68-75a8-3d1e-8ee8-37c5c8942763 JMS Content-Type: text/plain AMQ message number: -1 Properties:<NONE> ------------------------------- Jan 25, 2011 1:07:57 PM org.apache.qpid.client.AMQSession close INFO: Closing session: org.apache.qpid.client.AMQSession_0_10@4aeaf40c 0 XXD {} Jan 25, 2011 1:08:01 PM org.apache.qpid.client.AMQConnection <init> INFO: Connection:amqp://guest:********@test/test?brokerlist='tcp://localhost:5672' Jan 25, 2011 1:08:02 PM org.apache.qpid.client.protocol.AMQProtocolSession <init> INFO: Using ProtocolVersion for Session:0-10 Jan 25, 2011 1:08:02 PM org.apache.qpid.client.handler.ClientMethodDispatcherImpl newMethodDispatcher INFO: New Method Dispatcher:AMQProtocolSession[null] Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQConnection <init> INFO: Connecting with ProtocolHandler Version:0-10 Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQConnection <init> INFO: Connected with ProtocolHandler Version:0-10 Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQSession <init> INFO: Created session:org.apache.qpid.client.AMQSession_0_10@4aeaf40c Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQSession registerConsumer INFO: Prefetching delayed existing messages will not flow until requested via receive*() or setML(). Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQSession startDispatcherIfNecessary INFO: Dispatcher-Channel-1 created Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQSession$Dispatcher run INFO: Dispatcher-Channel-1 started ------------- Msg ------------- Body: __c__ JMS Correlation ID: null JMS timestamp: 1295957277230 JMS expiration: 0 JMS priority: 4 JMS delivery mode: 2 JMS reply to: null JMS Redelivered: false JMS Destination: :///XXD/XXD?routingkey='XXD' JMS Type: null JMS MessageID: ID:f8b55c68-75a8-3d1e-8ee8-37c5c8942763 JMS Content-Type: text/plain AMQ message number: 2 Properties:<NONE> ------------------------------- Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQSession close INFO: Closing session: org.apache.qpid.client.AMQSession_0_10@4aeaf40c Jan 25, 2011 1:08:02 PM org.apache.qpid.client.BasicMessageConsumer close INFO: Closing consumer:1[1652180105] Jan 25, 2011 1:08:02 PM org.apache.qpid.client.AMQSession$Dispatcher run INFO: Dispatcher-Channel-1 thread terminating for channel 1:org.apache.qpid.client.AMQSession_0_10@4aeaf40c 0 XXD [root@dhcp-27-225 examples]# qpid-config queues XXD Queue Name Attributes =================================== XXD
Fixed in upstream. http://svn.apache.org/viewvc?rev=1076670&view=rev
The fixes are now included in rpms from version qpid-java-0.9.1080013-2 Added technical notes to describe how the feature is implemented.
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 delete option in address syntax was not implemented. Consequence: A user is unable to specify the criteria for the deletion of a queue other than using auto-delete in the queue declare arguments. Fix: The JMS client now implements the delete option and supports one of {always|receiver|sender|never}. The default is set to 'never'. Result: Depending on the value of the delete option one of the following will happen, 1. sender - The queue will be deleted when the sender is closed. 2. receiver - The queue will be deleted when the receiver is closed. 3. always - The queue will be deleted when either the sender or receiver is closed. 4. never - The queue will not be deleted (unless auto-deleted is used or manually deleted by an admin). Please note that when a delete takes place, it will delete the queue regardless of whether the queue has messages or consumers on it. Therefore this option needs to be used carefully.
This issue has NOT been fixed Tested on RHEL5.6 x86_64, i686 The queue Q is not removed using following command: ./run_example.sh org.apache.qpid.example.Drain "Q; {delete: receiver}" # rpm -qa | grep qpid qpid-java-example-0.10-1.el5 qpid-cpp-server-0.10-1.el5 qpid-cpp-client-ssl-0.10-1.el5 qpid-qmf-devel-0.10-2.el5 python-qpid-0.10-1.el5 qpid-java-client-0.10-1.el5 qpid-cpp-client-devel-docs-0.10-1.el5 qpid-cpp-client-0.10-1.el5 qpid-qmf-0.10-2.el5 qpid-cpp-client-devel-0.10-1.el5 qpid-cpp-server-devel-0.10-1.el5 qpid-tools-0.10-1.el5 qpid-cpp-server-xml-0.10-1.el5 qpid-cpp-server-ssl-0.10-1.el5 qpid-cpp-server-cluster-0.10-1.el5 qpid-java-common-0.10-1.el5 python-qpid-qmf-0.10-2.el5 qpid-cpp-server-store-0.10-1.el5 # qpid-config queues | grep "^Q" Queue Name Attributes # ./run_example.sh org.apache.qpid.example.Spout --content=__c__ "Q; {create: sender}" {content=__c__} Apr 4, 2011 2:18:34 PM org.apache.qpid.client.security.DynamicSaslRegistrar registerSaslProviders INFO: Additional SASL providers successfully registered. Apr 4, 2011 2:18:34 PM org.apache.qpid.client.AMQConnection <init> INFO: Connection:amqp://guest:********@test/test?brokerlist='tcp://localhost:5672' Apr 4, 2011 2:18:34 PM org.apache.qpid.client.protocol.AMQProtocolSession <init> INFO: Using ProtocolVersion for Session:0-10 Apr 4, 2011 2:18:34 PM org.apache.qpid.client.handler.ClientMethodDispatcherImpl newMethodDispatcher INFO: New Method Dispatcher:AMQProtocolSession[null] Apr 4, 2011 2:18:34 PM org.apache.qpid.client.AMQConnection <init> INFO: Connecting with ProtocolHandler Version:0-10 Apr 4, 2011 2:18:34 PM org.apache.qpid.client.AMQConnection <init> INFO: Connected with ProtocolHandler Version:0-10 Apr 4, 2011 2:18:34 PM org.apache.qpid.client.AMQSession <init> INFO: Created session:org.apache.qpid.client.AMQSession_0_10@540984b Apr 4, 2011 2:18:35 PM org.apache.qpid.client.BasicMessageProducer setPublishMode INFO: MessageProducer org.apache.qpid.client.BasicMessageProducer_0_10@48082751 using publish mode : ASYNC_PUBLISH_ALL ------------- Msg ------------- Body: __c__ JMS Correlation ID: null JMS timestamp: 1301919515094 JMS expiration: 0 JMS priority: 4 JMS delivery mode: 2 JMS reply to: null JMS Redelivered: false JMS Destination: 'Q'/None; { 'create': 'sender' } JMS Type: null JMS MessageID: ID:dd0be9bf-9a7a-38c1-8777-32acc255bfed JMS Content-Type: text/plain AMQ message number: -1 Properties:<NONE> ------------------------------- Apr 4, 2011 2:18:35 PM org.apache.qpid.client.AMQSession close INFO: Closing session: org.apache.qpid.client.AMQSession_0_10@540984b Apr 4, 2011 2:18:35 PM org.apache.qpid.transport.util.Logger warn WARNING: CLOSED: [ssn:"9dc60ddb-b722-4096-b4fa-ce211df0273a"] # qpid-config queues | grep "^Q" Queue Name Attributes Q # ./run_example.sh org.apache.qpid.example.Drain "Q; {delete: receiver}" {} Apr 4, 2011 2:18:51 PM org.apache.qpid.client.security.DynamicSaslRegistrar registerSaslProviders INFO: Additional SASL providers successfully registered. Apr 4, 2011 2:18:51 PM org.apache.qpid.client.AMQConnection <init> INFO: Connection:amqp://guest:********@test/test?brokerlist='tcp://localhost:5672' Apr 4, 2011 2:18:52 PM org.apache.qpid.client.protocol.AMQProtocolSession <init> INFO: Using ProtocolVersion for Session:0-10 Apr 4, 2011 2:18:52 PM org.apache.qpid.client.handler.ClientMethodDispatcherImpl newMethodDispatcher INFO: New Method Dispatcher:AMQProtocolSession[null] Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQConnection <init> INFO: Connecting with ProtocolHandler Version:0-10 Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQConnection <init> INFO: Connected with ProtocolHandler Version:0-10 Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQSession <init> INFO: Created session:org.apache.qpid.client.AMQSession_0_10@540984b Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQSession registerConsumer INFO: Prefetching delayed existing messages will not flow until requested via receive*() or setML(). Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQSession startDispatcherIfNecessary INFO: Dispatcher-Channel-0 created Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQSession$Dispatcher run INFO: Dispatcher-Channel-0 started ------------- Msg ------------- Body: __c__ JMS Correlation ID: null JMS timestamp: 1301919515094 JMS expiration: 0 JMS priority: 4 JMS delivery mode: 2 JMS reply to: null JMS Redelivered: false JMS Destination: :///Q/Q?routingkey='Q' JMS Type: null JMS MessageID: ID:dd0be9bf-9a7a-38c1-8777-32acc255bfed JMS Content-Type: text/plain AMQ message number: 2 Properties:<NONE> ------------------------------- Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQSession close INFO: Closing session: org.apache.qpid.client.AMQSession_0_10@540984b Apr 4, 2011 2:18:52 PM org.apache.qpid.client.BasicMessageConsumer close INFO: Closing consumer:1[1908393212] Apr 4, 2011 2:18:52 PM org.apache.qpid.client.AMQSession$Dispatcher run INFO: Dispatcher-Channel-0 thread terminating for channel 0:org.apache.qpid.client.AMQSession_0_10@540984b Apr 4, 2011 2:18:52 PM org.apache.qpid.transport.util.Logger warn WARNING: CLOSED: [ssn:"bc2b8c4e-8160-41a2-9af0-37ac3d2ddf0d"] # echo $? 0 # qpid-config queues | grep "^Q" Queue Name Attributes Q -> ASSIGNED
This feature does work, subject to the following issue. If the session is closed (instead of first closing the consumer) which is what Drain.java is doing then the correct close method does not get called, hence the reason why it doesn't work when Drain is used. (Please note that this doesn't affect the producer. If a session gets closed, it correctly closes the producer and deletes the queue). If you call the close method on consumer directly then you can observe that the queue gets deleted. I will need to post this question upstream to figure out the reasons behind the close method in the session impl not invoking the close method on consumer with proper arguments.
In order to fix the subsequent issue identified in Comment#5 we need to port rev 1092510 [1] into the 2.0 release branch. However this commit has triggered a deadlock, Bug 697916., Therefore we are not able to be use this commit for the 2.0 release, as Bug 1092510 is out of scope for MRG 2.0 [1] http://svn.apache.org/viewvc?view=revision&revision=1092510
A fix has been made in upstream http://svn.apache.org/viewvc?rev=1397651&view=rev However when testing using Drain and Spout the above test will fail. The reason being Drain and Spout is not closing the Consumer and Producer before closing the session. You can test the above by either writing a quick test which closes the producer or consumer explicitly or try the modified Drain and Spout I will be checking into trunk shortly. P.S Now closing the session should close the producer and consumer implicitly. One could argue why are we not deleting the queue or exchange then. The reason is, before we issue the delete call we check if the session is alive for safety reasons. And currently not doing so can cause deadlocks. This is nothing to do with addressing, but rather a more general issue in the client.
/me hitting this bug on 0.18-6 with address: "testQueue_1; {create:always, delete:always}" I.e. it is worth testing also "delete:always" address string option (though quick review of the patch says it should be fixed).
(In reply to comment #12) > /me hitting this bug on 0.18-6 with address: > > "testQueue_1; {create:always, delete:always}" > > I.e. it is worth testing also "delete:always" address string option (though > quick review of the patch says it should be fixed). Hi Pavel, this works for me using java Spout/Drain on 0.18-6: # cd $javaapi/../../../..; ./run_example.sh org.apache.qpid.example.Drain "testQueue_1; {create:always, delete:always}" > /dev/null # qpid-config queues | grep testQueue_1 # cd $javaapi/../../../..; ./run_example.sh org.apache.qpid.example.Spout "testQueue_1; {create:always, delete:always}" > /dev/null # qpid-config queues | grep testQueue_1 # Generally the consumer / producer must be closed before closing the session, otherwise the address is not deleted. This change was applied to java Spout/Drain, please see: http://mrg1.lab.bos.redhat.com/git/?p=qpid.git;a=commit;h=02474565e1ce00d8c1f6be62dc0c188031c57db6
(In reply to comment #13) > (In reply to comment #12) > > /me hitting this bug on 0.18-6 with address: > > > > "testQueue_1; {create:always, delete:always}" > > > > I.e. it is worth testing also "delete:always" address string option (though > > quick review of the patch says it should be fixed). > > Hi Pavel, this works for me using java Spout/Drain on 0.18-6: Thanks for info, I really used old Spout+Drain..
The issue has been fixed. Verified on RHEL6.4 (i386, x86_64) packages installed: qpid-java-*-0.22-5 -> VERIFIED
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHEA-2014-1296.html