Qpid
  1. Qpid
  2. QPID-4666

[Java Broker] Incorrect exception messages returned following 0-10 MessageSubscribe failure

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 0.6, 0.8, 0.10, 0.12, 0.14, 0.16, 0.18, 0.20
    • Fix Version/s: 0.22
    • Component/s: Java Broker
    • Labels:
      None
    • Environment:

      Linux, Java 1.6, Qpid Java Client 0.20, Qpid Java Broker 0.23 (trunk)

      Description

      When AMQP client tries to subscribe to a queue which he is not allowed to assign to due to insufficient ACL rights, he seems to receive a slightly incorrect error message:

      Cannot subscribe to '1': Permission denied

      instead of:

      Cannot subscribe to 'queueName': Permission denied

      1. client.log
        23 kB
        JAkub Scholz
      2. QPID-4666.patch
        0.7 kB
        JAkub Scholz
      3. QPID-4666a.patch
        1 kB
        JAkub Scholz

        Activity

        Hide
        JAkub Scholz added a comment -

        Log file from the client

        Show
        JAkub Scholz added a comment - Log file from the client
        Hide
        JAkub Scholz added a comment - - edited

        The client sends a following command:
        [main] DEBUG org.apache.qpid.transport.Connection - SEND: [conn:29f429f4] ch=0 id=2 MessageSubscribe(queue=broadcast.CBKFR_CBKFRALMMACC1.TradeConfirmation, destination=1, acceptMode=EXPLICIT, acquireMode=PRE_ACQUIRED, resumeTtl=0, arguments=

        {x-filter-jms-selector=}

        )

        and receives following response:
        [IoReceiver - prmd05.xeop.de/172.16.11.49:61314] DEBUG org.apache.qpid.transport.Connection - RECV: [conn:29f429f4] ch=0 ExecutionException(errorCode=UNAUTHORIZED_ACCESS, commandId=2, description=Cannot subscribe to '1': Permission denied)

        As you can see, the destination is returned in the response instead of the queue name. This seems to be cause by the org.apache.qpid.server.transport.ServerSessionDelegate, which on the line 278 does this:
        exception(session, method, e, "Cannot subscribe to '" + destination);

        Instead of this:
        exception(session, method, e, "Cannot subscribe to '" + queueName);

        Attached is a patch with a fix. I'm not sure whether this doesn't cause any other problems, but it definitely fixes the error message in my case. Patch is attached.

        Show
        JAkub Scholz added a comment - - edited The client sends a following command: [main] DEBUG org.apache.qpid.transport.Connection - SEND: [conn:29f429f4] ch=0 id=2 MessageSubscribe(queue=broadcast.CBKFR_CBKFRALMMACC1.TradeConfirmation, destination=1, acceptMode=EXPLICIT, acquireMode=PRE_ACQUIRED, resumeTtl=0, arguments= {x-filter-jms-selector=} ) and receives following response: [IoReceiver - prmd05.xeop.de/172.16.11.49:61314] DEBUG org.apache.qpid.transport.Connection - RECV: [conn:29f429f4] ch=0 ExecutionException(errorCode=UNAUTHORIZED_ACCESS, commandId=2, description=Cannot subscribe to '1': Permission denied) As you can see, the destination is returned in the response instead of the queue name. This seems to be cause by the org.apache.qpid.server.transport.ServerSessionDelegate, which on the line 278 does this: exception(session, method, e, "Cannot subscribe to '" + destination); Instead of this: exception(session, method, e, "Cannot subscribe to '" + queueName); Attached is a patch with a fix. I'm not sure whether this doesn't cause any other problems, but it definitely fixes the error message in my case. Patch is attached.
        Hide
        JAkub Scholz added a comment -

        The promised patch ...

        Show
        JAkub Scholz added a comment - The promised patch ...
        Hide
        JAkub Scholz added a comment -

        Or maybe even better, we can change it just for the AMQSecurityException and leave the destination in the exception for everything else ...

        Show
        JAkub Scholz added a comment - Or maybe even better, we can change it just for the AMQSecurityException and leave the destination in the exception for everything else ...
        Hide
        Robbie Gemmell added a comment -

        Hi JAkub,

        I had a chat with Rob and we thought that including the queue name and the destination would probably be a good idea, so I have made that change on trunk. I fixed a typo in a related exception as well and so have tweaked the JIRA title accordingly.

        The change was committed as http://svn.apache.org/r1461895

        If you let me know this works ok for you I'll then request it for inclusion in 0.22.

        Robbie

        Show
        Robbie Gemmell added a comment - Hi JAkub, I had a chat with Rob and we thought that including the queue name and the destination would probably be a good idea, so I have made that change on trunk. I fixed a typo in a related exception as well and so have tweaked the JIRA title accordingly. The change was committed as http://svn.apache.org/r1461895 If you let me know this works ok for you I'll then request it for inclusion in 0.22. Robbie
        Hide
        JAkub Scholz added a comment -

        Hi Robbie,

        Thanks for the commit. I tested it and it seems to work fine ... with latest trunk I'm now getting following Exception containing both the queue name as well as the destination:

        [IoReceiver - prmd05.xeop.de/172.16.11.49:61314] DEBUG org.apache.qpid.transport.Connection - RECV: [conn:cc00cc0] ch=0 ExecutionException(errorCode=UNAUTHORIZED_ACCESS, commandId=2, description=Cannot subscribe to queue 'broadcast.CBKFR_CBKFRALMMACC1.TradeConfirmation' with destination '1': Permission denied)

        So from my point of view it is fixed and good to go.

        Thanks & Regards
        Jakub

        Show
        JAkub Scholz added a comment - Hi Robbie, Thanks for the commit. I tested it and it seems to work fine ... with latest trunk I'm now getting following Exception containing both the queue name as well as the destination: [IoReceiver - prmd05.xeop.de/172.16.11.49:61314] DEBUG org.apache.qpid.transport.Connection - RECV: [conn:cc00cc0] ch=0 ExecutionException(errorCode=UNAUTHORIZED_ACCESS, commandId=2, description=Cannot subscribe to queue 'broadcast.CBKFR_CBKFRALMMACC1.TradeConfirmation' with destination '1': Permission denied) So from my point of view it is fixed and good to go. Thanks & Regards Jakub
        Hide
        Robbie Gemmell added a comment -

        Resolving against 0.23 for now, will request inclusion in 0.22

        Show
        Robbie Gemmell added a comment - Resolving against 0.23 for now, will request inclusion in 0.22
        Hide
        Justin Ross added a comment -

        Reviewed by Robbie. Approved for 0.22.

        Show
        Justin Ross added a comment - Reviewed by Robbie. Approved for 0.22.
        Hide
        Robbie Gemmell added a comment -

        Now merged to the 0.22 release branch:
        http://svn.apache.org/r1462775

        Show
        Robbie Gemmell added a comment - Now merged to the 0.22 release branch: http://svn.apache.org/r1462775

          People

          • Assignee:
            Robbie Gemmell
            Reporter:
            JAkub Scholz
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development