Description of problem: When the node name in the address string starts with '#' character the node shall be created (and removed on link close) due to consistency with C++ client. Using python client the desired node is NOT created. Please see additional info for details. Version-Release number of selected component (if applicable): python-qpid-0.22-13 How reproducible: 100% Steps to Reproduce: 1. ./drain.py '#q' 2. no such queue exception Actual results: When the node name starts with '#' character the node is NOT created Expected results: When the node name starts with '#' character the node is created and removed after the link is closed Additional info: python client: # ./drain.py '#q' Traceback (most recent call last): ... qpid.messaging.exceptions.NotFound: no such queue: c2cd1162-d0a1-42c4-8f78-fe27aaf8cfea#q C++ client: # ./drain -t 1 "#q" & qpid-config queues; sleep 1; qpid-config queues [1] 28029 Queue Name Attributes ================================================================= 441d5b59-4f9f-4eb5-9a34-fe81b0f8efab:0.0 auto-del excl ea0b1fd1-ee6f-440f-82bd-016b049822db#q auto-del excl [1]+ Done ./qc2_drain -t 1 "#q" Queue Name Attributes ================================================================= 78abdff1-c255-441d-98d1-3277fe4cbc17:0.0 auto-del excl
A trivial patch covering the basic usage is: --- /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.orig 2014-01-28 18:49:12.000000000 +0100 +++ /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.new 2014-06-15 14:32:27.825739016 +0200 @@ -758,6 +758,8 @@ class Session(Endpoint): def _mangle(addr): if addr and addr.startswith("#"): + if (";" not in addr): # ensure queue is created as auto-delete exclusive + addr = addr + "; {create:always, node:{ x-declare:{auto-delete:True, exclusive:True}}}" return str(uuid4()) + addr else: return addr It covers addresses without options. If an address is like "#q; { .. }", then the patch won't help. Fixing all those options would be quite complex. C++ client has whole class about it, to parse the address string and potentially modify it like with "#". Not sure if worth spending time on that just for this use case. Petre, is this change sufficient?
Disregard the previous.. /me was stupid, python client has similar address string parsing. Following what C++ client does: if (qpid::messaging::AddressImpl::isTemporary(a) && createPolicy.isVoid()) { createPolicy = "always"; Opt specified = Opt(a)/NODE/X_DECLARE; if (!specified.hasKey(AUTO_DELETE)) autoDelete = true; if (!specified.hasKey(EXCLUSIVE)) exclusive = true; } Python patch should be: --- /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.orig 2014-01-28 18:49:12.000000000 +0100 +++ /usr/lib/python2.6/site-packages/qpid/messaging/endpoints.py.new 2014-06-15 15:02:03.868738972 +0200 @@ -587,7 +587,6 @@ class Session(Endpoint): @rtype: Sender @return: a new Sender for the specified target """ - target = _mangle(target) sender = Sender(self, self.next_sender_id, target, options) self.next_sender_id += 1 self.senders.append(sender) @@ -611,7 +610,6 @@ class Session(Endpoint): @rtype: Receiver @return: a new Receiver for the specified source """ - source = _mangle(source) receiver = Receiver(self, self.next_receiver_id, source, options) self.next_receiver_id += 1 self.receivers.append(receiver) @@ -756,12 +754,6 @@ class Session(Endpoint): finally: self.connection._remove_session(self) -def _mangle(addr): - if addr and addr.startswith("#"): - return str(uuid4()) + addr - else: - return addr - class Sender(Endpoint): """ --- /usr/lib/python2.6/site-packages/qpid/messaging/driver.py.orig 2014-01-28 18:49:12.000000000 +0100 +++ /usr/lib/python2.6/site-packages/qpid/messaging/driver.py.new 2014-06-15 15:01:29.976739603 +0200 @@ -34,6 +34,7 @@ from qpid.selector import Selector from qpid.util import URL, default from qpid.validator import And, Context, List, Map, Types, Values from threading import Condition, Thread +from qpid.datatypes import uuid4 log = getLogger("qpid.messaging") rawlog = getLogger("qpid.messaging.io.raw") @@ -944,6 +945,16 @@ class Engine: # XXX: subject if lnk.options is None: lnk.options = {} + # if address starts with '#', create auxiliary queue with name preceded by uuid + if addr.startswith("#") and 'create' not in lnk.options: + lnk.name = str(uuid4()) + lnk.name + lnk.options['create'] = "always" + if 'node' not in lnk.options: + lnk.options['node'] = {} + if 'x-declare' not in lnk.options['node']: + lnk.options['node']['x-declare'] = {} + lnk.options['node']['x-declare']['auto-delete'] = "True" + lnk.options['node']['x-declare']['exclusive'] = "True" except address.LexError, e: return MalformedAddress(text=str(e)) except address.ParseError, e: /me to run automated tests..
Autotests passed. Committed to upstream r1602820.
(In reply to Pavel Moravec from comment #3) > Autotests passed. > > Committed to upstream r1602820. Disregard.. that breaks application to get expanded address. A fix proposal covering that is at https://reviews.apache.org/r/22630/
Committed revision 1608350. This is the only commit relevant for / fixing this BZ.
*** Bug 1086817 has been marked as a duplicate of this bug. ***
When the temporary node is requested (using address starting with '#' character) using the Qpid python client, the temporary node created has always auto-delete and exclusive flags set to true, even if explicitly requested otherwise. I believe that there still should be possibility to declare the temporary node to be non-auto-delete/non-exclusive as with Qpid C++ client, this is imho needless inconsistency. Feel free to argue. C++ client: # ./drain -t 5 "#q-non-exclusive;{node:{x-declare:{exclusive:False}}}" & c52b06ff-ca57-40f4-ac10-fccb5a114795#q-non-exclusive auto-del # ./drain -t 5 "#q-non-auto-delete;{node:{x-declare:{auto-delete:False}}}" & deda220f-4e80-49de-ab52-16ac4ff082e9#q-non-auto-delete excl Python client: # ./drain -t 5 "#q-non-exclusive;{node:{x-declare:{exclusive:False}}}" & a0ca7851-73a4-49a8-bb64-cec2f42c5cef#q-non-exclusive auto-del excl # ./drain -t 5 "#q-non-auto-delete;{node:{x-declare:{exclusive:False}}}" & 76b0b2f4-8b44-40e4-b968-69ca756b63b1#q-non-auto-delete auto-del excl
The proposal makes sense. Committed to upstream as 1656278.
This issue has been fixed. Verified on rhel6.6 (x86_64 and i386) and rhel7. Packages: qpid-cpp-*-0.30-6 -> VERIFIED
(In reply to Petr Matousek from comment #13) > This issue has been fixed. Verified on rhel6.6 (x86_64 and i386) and rhel7. > > Packages: > qpid-cpp-*-0.30-6 > > -> VERIFIED - qpid-cpp-*-0.30-6 + python-qpid-0.30-5
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. https://rhn.redhat.com/errata/RHEA-2015-0805.html