Qpid
  1. Qpid
  2. QPID-4666

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • 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. QPID-4666a.patch
        1 kB
        JAkub Scholz
      2. QPID-4666.patch
        0.7 kB
        JAkub Scholz
      3. client.log
        23 kB
        JAkub Scholz

        Activity

        JAkub Scholz created issue -
        Hide
        JAkub Scholz added a comment -

        Log file from the client

        Show
        JAkub Scholz added a comment - Log file from the client
        JAkub Scholz made changes -
        Field Original Value New Value
        Attachment client.log [ 12575326 ]
        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 ...
        JAkub Scholz made changes -
        Attachment QPID-4666.patch [ 12575327 ]
        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 ...
        JAkub Scholz made changes -
        Attachment QPID-4666a.patch [ 12575334 ]
        Robbie Gemmell made changes -
        Assignee Robbie Gemmell [ gemmellr ]
        Robbie Gemmell made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Robbie Gemmell made changes -
        Fix Version/s 0.21 [ 12323549 ]
        Robbie Gemmell made changes -
        Fix Version/s 0.22 [ 12324272 ]
        Fix Version/s 0.21 [ 12323549 ]
        Robbie Gemmell made changes -
        Summary Incorrect exception message returned in MessageSubscribe when permission is denied [Java Broker] Incorrect exception messages returned following 0-10 MessageSubscribe failure
        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
        Robbie Gemmell made changes -
        Affects Version/s 0.20 [ 12323548 ]
        Affects Version/s 0.18 [ 12322451 ]
        Affects Version/s 0.16 [ 12319870 ]
        Affects Version/s 0.14 [ 12316855 ]
        Affects Version/s 0.12 [ 12316848 ]
        Affects Version/s 0.10 [ 12316273 ]
        Affects Version/s 0.8 [ 12315477 ]
        Affects Version/s 0.6 [ 12313728 ]
        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
        Robbie Gemmell made changes -
        Fix Version/s 0.23 [ 12324273 ]
        Fix Version/s 0.22 [ 12324272 ]
        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
        Robbie Gemmell made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        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
        Robbie Gemmell made changes -
        Fix Version/s 0.22 [ 12324272 ]
        Fix Version/s 0.23 [ 12324273 ]
        Rob Godfrey made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

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

            Dates

            • Created:
              Updated:
              Resolved:

              Development