Qpid
  1. Qpid
  2. QPID-2453

Python messaging client unusable after receiving a malformed message

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 0.23
    • Component/s: Python Client
    • Labels:
      None

      Description

      Description of problem:

      This bug is in reference to the new messaging API.

      If the Python messaging client (qpid.messaging) receives a message which is in any way malformed (i.e. improper UTF8 encoding in strings, unknown content-type), it throws an exception on the receiver.fetch call. From this point forward, the API is unusable. Any attempt to recover or call methods in the API (session.close, connection.close, fetch on other receivers, etc.) will result in the same exception repeating itself.

      Version-Release number of selected component (if applicable):

      Development trunk.

      How reproducible:

      100%

      Steps to Reproduce:
      1. Produce a message with a content-type of "amqp/xxx"
      2. Send this message to a queue
      3. Set up a receiver to receive the message from the queue
      4. Call fetch on the receiver

      Actual results:

      An exception is thrown and subsequent calls repeat the exception (i.e. trying
      to close the receiver, session, or connection). The only way out is to kill
      the client process.

      Expected/Desired results:

      The malformed messages should be received normally. Perhaps there should be a
      "malformed" flag on the message that can be checked, or an exception should be
      thrown when attempting to access the content of the message.

      In no case should this cause an unrecoverable condition.

      1. python-tests.patch
        0.8 kB
        Ernest Allen
      2. qpid-2453.patch
        3 kB
        Ernest Allen
      3. test.py
        1 kB
        Ernest Allen

        Activity

        Hide
        Ernest Allen added a comment -

        Test that exposes problem. Uses content_type="amqp/map" with string content.

        Show
        Ernest Allen added a comment - Test that exposes problem. Uses content_type="amqp/map" with string content.
        Hide
        Ernest Allen added a comment -

        Attached qpid-2453 patch. This introduces a non-blocking type of exception that will return the exception to the application but not prevent future operations on the connection.

        The only non-blocking exceptions allowed for are endcode exceptions that raise AttributeError (happens when a amqp/map content_type is specified but the content isn't a dict) and any decode exception. All other exceptions like memory or connection problems will continue to work the same way.

        Show
        Ernest Allen added a comment - Attached qpid-2453 patch. This introduces a non-blocking type of exception that will return the exception to the application but not prevent future operations on the connection. The only non-blocking exceptions allowed for are endcode exceptions that raise AttributeError (happens when a amqp/map content_type is specified but the content isn't a dict) and any decode exception. All other exceptions like memory or connection problems will continue to work the same way.
        Hide
        Ernest Allen added a comment -

        Attached python-tests.patch to ensure exceptions while encoding/decoding messages are not fatal.

        Show
        Ernest Allen added a comment - Attached python-tests.patch to ensure exceptions while encoding/decoding messages are not fatal.
        Hide
        Justin Ross added a comment -

        Ernie, I think this one needs to go to review board. I looked at it, and I have two uncertainties: (1) is that the best way to filter the exceptions? and (2) is the name "nonblocking" right in this context?

        Show
        Justin Ross added a comment - Ernie, I think this one needs to go to review board. I looked at it, and I have two uncertainties: (1) is that the best way to filter the exceptions? and (2) is the name "nonblocking" right in this context?
        Hide
        Justin Ross added a comment -
        Show
        Justin Ross added a comment - http://svn.apache.org/viewvc?view=revision&revision=1471158 Patch courtesy of Ernie Allen.
        Hide
        Justin Ross added a comment -
        Show
        Justin Ross added a comment - Released in Qpid 0.24, http://qpid.apache.org/releases/qpid-0.24/index.html

          People

          • Assignee:
            Unassigned
            Reporter:
            Ted Ross
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development