[ 
https://issues.apache.org/jira/browse/QPID-6226?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14214540#comment-14214540
 ] 

Keith Wall commented on QPID-6226:
----------------------------------

There is a behavioural difference between the C++ and Java Broker.

The relevant parts of spec:

AMQP Spec 0-10 p230.

bq. Exception: passive. Error not-found. The client MAY ask the server to 
assert that a queue exists without creating the queue if not. If the queue does 
not exist, the server treats this as a failure. Scenario: Client declares an 
existing queue with the passive option and expects the command to succeed. 
Client then attempts to declare a non-existent queue with the passive option, 
and the server must close the session with the correct exception.

bq. Exception: in-use. Error resource-locked.  If the server receives a 
declare, bind, consume or get request for a queue that has been declared as 
exclusive by an existing client session, it MUST raise an exception Scenario: A 
client declares an exclusive named queue. A second client on a different 
session attempts to declare a queue of the same name.

The spec is not too helpful as it does not indicate how the passive and in-use 
rules should work together. 

The implementations:

org.apache.qpid.server.protocol.v0_10.ServerSessionDelegate#queueDeclare
cpp/qpid/broker/SessionAdapter.cpp:312

In CPP, in the passive declare case, and iff the queue declare passes the 
exclusive flag, then it performs a check to ensure that the session that 
created the queue matches that of the invoking session.  If the exclusive flag 
is set false, it does not perform this check. 

In Java, in the passive declare case, the queue declare exclusivity argument is 
not considered. Java merely asserts that the session that created the queue 
matches that of the invoking session.   It has a strict interpretration of the 
'in-use' rule.

So, what should change?  Going back to the failing request/response use-case, 
it seems to me

* the client is reasonable in its creation of a exclusive queue for the purpose 
of reply-to..
* the server is making reasonable use of the passive queue.declare to assert 
that the reply to queue should exist.  

I therefore think that CPP is preferable.    Java Broker should change so that 
on the passive declare path, it only considers session access if the exclusive 
argument is passed as true i.e. insert "exclusive &&" to the expression on line 
1315.







> Running client/server C++ client examples fail against the Java Broker with 
> 'Cannot declare queue..'
> ----------------------------------------------------------------------------------------------------
>
>                 Key: QPID-6226
>                 URL: https://issues.apache.org/jira/browse/QPID-6226
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Client, Java Broker
>    Affects Versions: 0.30
>         Environment: Qpid C++ client
> Built from source from Trunk (rev 1638936)
> Running on Fedora 20 (guest OS).
> Qpid Java Broker
> Trunk (rev 1638936)
> Running on Mac OS X
>            Reporter: Keith Wall
>         Attachments: client.log, server.log
>
>
> Running the Qpid C++ client examples client/server against a clean Java 
> Broker ends with the following error being emitted by the server example.
> {noformat}
> 2014-11-13 23:20:09 [Client] debug treating target address as queue: 
> 8564d8c8-1fc3-4a96-bb04-4e21795049e2#;{node:{type:queue}}
> 2014-11-13 23:20:09 [Network] trace SENT 
> [[10.211.55.15:55482-192.168.1.6:5672]]: Frame[BEbe; channel=1; 
> {QueueDeclareBody: queue=8564d8c8-1fc3-4a96-bb04-4e21795049e2#; 
> alternate-exchange=; passive=1; arguments={}; }]
> 2014-11-13 23:20:09 [Network] trace RECV 
> [[10.211.55.15:55482-192.168.1.6:5672]]: Frame[BEbe; channel=1; 
> {ExecutionExceptionBody: error-code=405; command-id=8; description=Cannot 
> declare queue('8564d8c8-1fc3-4a96-bb04-4e21795049e2#'), as exclusive queue 
> with same name declared on another session; }]
> 2014-11-13 23:20:09 [System] debug Exception constructed: Cannot declare 
> queue('8564d8c8-1fc3-4a96-bb04-4e21795049e2#'), as exclusive queue with same 
> name declared on another session
> 2014-11-13 23:20:09 [Client] warning Exception received from broker: 
> resource-locked: Cannot declare 
> queue('8564d8c8-1fc3-4a96-bb04-4e21795049e2#'), as exclusive queue with same 
> name declared on another session [caused by 8 \x00:\x00]
> resource-locked: Cannot declare 
> queue('8564d8c8-1fc3-4a96-bb04-4e21795049e2#'), as exclusive queue with same 
> name declared on another session
> {noformat}
> It appears that both the client and server declare the temporary queue for 
> the response:
> {noformat}
> (client)
> 2014-11-13 23:20:09 [Network] trace SENT 
> [[10.211.55.15:55483-192.168.1.6:5672]]: Frame[BEbe; channel=1; 
> {QueueDeclareBody: queue=8564d8c8-1fc3-4a96-bb04-4e21795049e2#; 
> alternate-exchange=; exclusive=1; auto-delete=1; arguments={}; }]
> {noformat}
> {noformat}
> (server)
> 2014-11-13 23:20:09 [Network] trace SENT 
> [[10.211.55.15:55482-192.168.1.6:5672]]: Frame[BEbe; channel=1; 
> {QueueDeclareBody: queue=8564d8c8-1fc3-4a96-bb04-4e21795049e2#; 
> alternate-exchange=; passive=1; arguments={}; }]
> {noformat}
> The error suggests a behaviour difference between CPP and Java Broker around 
> the handling of the passive flag.
> I am running:
> {noformat}
> ./server 192.168.1.6:5672   '{username:guest,password:guest}'
> ./client 192.168.1.6:5672   '{username:guest,password:guest}'
> {noformat}
> with QPID_LOG_ENABLE set for tracing.
> {noformat}
> export QPID_LOG_ENABLE="trace+"
> {noformat}
> Java Broker is out of the box i.e. default Auth Provider (Plain) and default 
> password db.
> I get no error when running the same programs against the CPP broker.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to