Bug 1048151

Summary: difference in behaviour between AMQP 0-10 and AMQP 1.0 when ambiguous address is used and node type not specified
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: Messaging_Installation_and_Configuration_GuideAssignee: Jared MORGAN <jmorgan>
Status: CLOSED CURRENTRELEASE QA Contact: Petr Matousek <pematous>
Severity: low Docs Contact:
Priority: unspecified    
Version: DevelopmentCC: esammons, gsim, jross, mmurray
Target Milestone: 3.0   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-22 15:28:39 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 2014-01-03 09:56:55 UTC
Description of problem:

When a client use an ambiguous address (both the queue and exchange of the same name exists) and do not explicitly specify the node type, the queue is used by default over amqp1.0. No exception/warning is printed out.

There is following exception in the same scenario when using amqp0-10 client:
Ambiguous address, please specify queue or topic as node type
(return code is non-zero, message is not sent)

The clients shall behave the same way where possible. 

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

How reproducible:
100%

Steps to Reproduce:
1. qpid-config add queue node
2. qpid-config add exchange topic node
3. ./spout --connection-options "{  protocol : 'amqp1.0' }" node

Actual results:
No exception/warning reported, message is sent towards the queue when ambiguous node is used

Expected results:
Exception is reported, message is not sent when ambiguous address is used and node type not explicitly specified 

Additional info:
# qpid-config add queue node
# qpid-config add exchange topic node
# $cppapi/spout node
Ambiguous address, please specify queue or topic as node type
# echo $?
1
# $cppapi/spout --connection-options "{  protocol : 'amqp1.0' }" node
# echo $?
0
# qpid-stat -q
  queue                                     dur  autoDel  excl  msg   msgIn  msgOut  bytes  bytesIn  bytesOut  cons  bind =========================================================================================================================
  node                                                             1     1      0      65     65        0         0     1

Comment 1 Gordon Sim 2014-01-03 10:27:09 UTC
Though the client is not informed in any way of the ambiguity, a warning is logged by the broker when the node matches both a queue and an exchange and no specific type is specified.

There is clearly a difference in behaviour between 1.0 and 0-10 here, but I'm not 100% convinced it is wrong as it is.

In 0-10, the namespace for queues and exchanges is clearly separate. The messaging API creates the illusion of a unified node namespace on top of that. Resolution is done by the client using standard 0-10.

In 1.0 on the other hand there is the expectation of a single node namespace for containers, the resolution happens on the server and the mechanism for passing the type is not standard 1.0. The ambiguity can be dealt with by creating a topic to expose the exchange over 1.0 by another name that doesn't clash with a queue.

I'm happy to hear counter-arguments, and the change is not difficult to make, but at present I feel on balance the difference in behaviour between 0-10 and 1.0 is justified in terms of 'better' behaviour for each. Thoughts?

Comment 2 Petr Matousek 2014-01-03 10:44:16 UTC
Confirmed, following warning is logged by the broker:
[Protocol] warning Ambiguous node name; node could be queue or exchange, assuming queue

I'm not claiming that the 1.0 behavior is necessarily wrong. These kind of bugs are filled due to Vienna requirements for 0-10/1.0 equivalent functionality and address string compatibility. I personally do not have any objection to leave the behavior as it is. 

So feel free to "close/won't fix" or better change to documentation bug.

Comment 3 Gordon Sim 2014-01-03 11:07:09 UTC
(In reply to Petr Matousek from comment #2)
> These kind of bugs are filled due to Vienna requirements for 0-10/1.0
> equivalent functionality and address string compatibility. 

Understood, and I really appreciate you raising these discrepancies. 

Exact equivalence isn't always possible however, and in this case I feel it would impact another requirement (which may not be explicitly stated for Vienna, but is important nevertheless), that the broker expose its functions over 1.0 in as natural a way as possible, relying on extensions only where it must.

Justin: I'm inclined to leave the behaviour as is for this one. Do you have an opinion?

Comment 4 Justin Ross 2014-01-03 16:40:37 UTC
(In reply to Gordon Sim from comment #3)
> Exact equivalence isn't always possible however, and in this case I feel it
> would impact another requirement (which may not be explicitly stated for
> Vienna, but is important nevertheless), that the broker expose its functions
> over 1.0 in as natural a way as possible, relying on extensions only where
> it must.
> 
> Justin: I'm inclined to leave the behaviour as is for this one. Do you have
> an opinion?

I agree that it's better to "look forward" and not hold over a 0-10 behavior for the 1.0 protocol.

The requirement is stated with little flexibility.  If we did it over again, I'd insist on a "reasonable exceptions" clause so we can make judgment calls like this.

As Petr mentions, it would be nice to document this change in behavior.

Comment 5 Gordon Sim 2014-01-03 16:44:43 UTC
Changing to a documentation bug.

Comment 6 Gordon Sim 2014-01-03 17:18:10 UTC
Note that the difference is only visible using the c++ based qpid::messaging client against qpidd (the python 0-10 client also does not throw an exception in this case).

Comment 8 Petr Matousek 2014-05-23 14:46:19 UTC
The content seems well only following text must be removed (it is not part of the exception): 
"(return code is non-zero, message is not sent)"

It is possible to describe that the message is not sent and the return code is non-zero, but not as a part of the exception. This information is IMO not necessary and may be removed at all.

Comment 10 Petr Matousek 2014-06-10 08:57:22 UTC
Content approved.