Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 574571

Summary: Python messaging client unusable after receiving a malformed message
Product: Red Hat Enterprise MRG Reporter: Ted Ross <tross>
Component: python-qpidAssignee: Ernie <eallen>
Status: CLOSED ERRATA QA Contact: mick <mgoulish>
Severity: high Docs Contact:
Priority: high    
Version: DevelopmentCC: gsim, jross, lzhaldyb, mgoulish, mtoth, tross
Target Milestone: 3.0Keywords: Patch, TestCaseProvided
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: python-qpid-0.22-3.el6, python-qpid-0.22-2.el5 Doc Type: Bug Fix
Doc Text:
It was discovered that setting the content-type of a message to `amqp/map` when the content is not a map created an exception. All further operations on the session or connections raised the original exception, which rendered the API unusable at that point. The fix ensures the original encoding exception is not raised again after it has been passed back to the calling application. A mismatched content type will still raise an exception, but will not prevent further operations.
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-09-24 15:01:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test that exposes bug
none
Capture encode and decode exceptions
none
Add python tests
none
Renamed exception to ContentError none

Description Ted Ross 2010-03-17 20:40:05 UTC
Description of problem:

If the Python messaging client (qpid.messaging) receives a message in which the content does not match the 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 string content but a content-type of "amqp/list"
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.

Additional info:

Comment 1 Ted Ross 2010-03-17 20:49:38 UTC
Another, simpler way to reproduce this is to create the message with an unknown content-type (i.e. amqp/list1).  This will also cause the receiving script to throw the never-clearing exception.

Comment 2 Ted Ross 2010-03-17 22:47:30 UTC
Upstream at https://issues.apache.org/jira/browse/QPID-2453

Comment 4 Justin Ross 2012-12-12 16:34:57 UTC
Upstream jira does not indicate any fix. -> ASSIGNED

Comment 5 Ernie 2013-01-16 19:22:37 UTC
Created attachment 679756 [details]
Test that exposes bug

The cases in the bz description and comment 1 don't cause this bug anymore. 

However, using content type of "ampq/map" with string content will throw an exception when attempting to send the message. After which all subsequent commands fail with the original exception returned.

Comment 6 Ernie 2013-01-22 16:49:08 UTC
Created attachment 685286 [details]
Capture encode and decode exceptions

Fix only addresses encode and decode exceptions. It returns the exception to the app. Other exceptions are handled the same way they were: they block all operations on the connection.

Comment 7 Ernie 2013-01-23 15:24:17 UTC
Created attachment 686001 [details]
Add python tests

Adds tests to ensure operations can continue after receiving an encode/decode exception.

Comment 8 Ernie 2013-04-19 16:00:27 UTC
Created attachment 737691 [details]
Renamed exception to ContentError

Comment 9 Justin Ross 2013-04-23 21:45:12 UTC
-> POST

http://svn.apache.org/viewvc?view=revision&revision=1471158

Comment 10 mick 2013-06-25 15:25:00 UTC
I'm working on verifying this one, subject to approval by Leonid.

Comment 11 mick 2013-06-26 15:29:59 UTC
Important step before attempting repro:

  qpid-config add queue q-4-574571

Comment 12 mick 2013-06-26 15:32:19 UTC
repro successful using broker built from svn version 1471157

no repro (reproducer finishes happy) using installed packages from Vienna RC5.


I would call this one verified, except I have not yet learned all proper QE mechanisms / conventions.

Comment 13 mick 2013-07-10 14:27:16 UTC
    Verified after testing on   { 32-bit , 64-bit } x { RHEL 5.9 , RHEL 6.4 }

    packages
    {
      RHEL 5.9
      {
        cyrus-sasl-2.1.22-7.el5_8.1
        cyrus-sasl-devel-2.1.22-7.el5_8.1
        cyrus-sasl-lib-2.1.22-7.el5_8.1
        cyrus-sasl-plain-2.1.22-7.el5_8.1
        python-qpid-0.22-4.el5
        python-qpid-qmf-0.22-5.el5
        python-saslwrapper-0.22-2.el5
        qpid-cpp-client-0.22-6.el5
        qpid-cpp-client-devel-0.22-6.el5
        qpid-cpp-server-0.22-6.el5
        qpid-java-client-0.22-2.el5
        qpid-java-common-0.22-2.el5
        qpid-java-example-0.22-2.el5
        qpid-proton-c-0.4-2.2.el5
        qpid-qmf-0.22-5.el5
        qpid-tools-0.22-2.el5
        saslwrapper-0.22-2.el5
      }

      RHEL 6.4
      {
        cyrus-sasl-2.1.23-13.el6_3.1
        cyrus-sasl-devel-2.1.23-13.el6_3.1
        cyrus-sasl-gssapi-2.1.23-13.el6_3.1
        cyrus-sasl-lib-2.1.23-13.el6_3.1
        cyrus-sasl-md5-2.1.23-13.el6_3.1
        cyrus-sasl-plain-2.1.23-13.el6_3.1
        python-qpid-0.22-4.el6.noarch
        python-qpid-qmf-0.22-5.el6
        python-saslwrapper-0.22-3.el6
        qpid-cpp-client-0.22-6.el6
        qpid-cpp-client-devel-0.22-6.el6
        qpid-cpp-server-0.22-6.el6
        qpid-proton-c-0.4-2.2.el6
        qpid-proton-c-devel-0.4-2.2.el6
        qpid-qmf-0.22-5.el6
        qpid-tools-0.22-3.el6.noarch
        saslwrapper-0.22-3.el6
      }
    }

Comment 14 mick 2013-07-10 15:34:34 UTC
tcms test case number:  261360

Comment 15 mick 2013-07-12 14:06:35 UTC
The python tests that were added are:

  testExceptionRaisedMismatchedContentType , and
  testRecoverAfterException

Comment 18 errata-xmlrpc 2014-09-24 15:01:46 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHEA-2014-1296.html