Fix exception handling in the method wrap_messaging_exception() in rpc/base.py

Bug #1750752 reported by Renat Akhmerov
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mistral
Fix Released
High
Renat Akhmerov

Bug Description

Looking on the Pike version of `/usr/lib/python2.7/site-packages/mistral/rpc/base.py`:

``` def decorator(*args, **kwargs):
        try:
            return method(*args, **kwargs)

        except exc.MistralException:
            raise
        except (client.RemoteError, exc.KombuException, Exception) as e:
            if hasattr(e, 'exc_type') and hasattr(exc, e.exc_type):
                exc_cls = getattr(exc, e.exc_type)
                raise exc_cls(e.value) ################### This is line 107

            _wrap_exception_and_reraise(e)
```

At this place Mistral swallows the original exception.

For example, if we got:

```RemoteError: Remote error: SizeLimitExceededException Size of 'params' is 1073KB which exceeds the limit of 1024KB```

we won't see any details about it although this exception could be fixed easily just by providing the right configuration option.

Changed in mistral:
milestone: none → rocky-1
assignee: nobody → Renat Akhmerov (rakhmerov)
importance: Undecided → High
status: New → Confirmed
tags: added: queens-backport
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (master)

Fix proposed to branch: master
Review: https://review.openstack.org/550399

Changed in mistral:
status: Confirmed → In Progress
Revision history for this message
Moshe Elisha (melisha) wrote :

There are two issues here:
1. The stacktrace of the original exception is lost.
2. SizeLimitExceededException exception does not have an init method matching "exc_cls(e.value)"

Revision history for this message
Renat Akhmerov (rakhmerov) wrote : Re: [Bug 1750752] Re: Fix exception handling in the method wrap_messaging_exception() in rpc/base.py

Hm.. But I checked it. The patch worked for me. Maybe I misunderstood something.

Thanks

Renat Akhmerov
@Nokia

7 марта 2018 г., 21:11 +0700, Moshe Elisha <email address hidden>, писал:
> There are two issues here:
> 1. The stacktrace of the original exception is lost.
> 2. SizeLimitExceededException exception does not have an init method matching "exc_cls(e.value)"
>
> --
> You received this bug notification because you are subscribed to the bug
> report.
> https://bugs.launchpad.net/bugs/1750752
>
> Title:
> Fix exception handling in the method wrap_messaging_exception() in
> rpc/base.py
>
> Status in Mistral:
> In Progress
>
> Bug description:
> Looking on the Pike version of `/usr/lib/python2.7/site-
> packages/mistral/rpc/base.py`:
>
> ``` def decorator(*args, **kwargs):
> try:
> return method(*args, **kwargs)
>
> except exc.MistralException:
> raise
> except (client.RemoteError, exc.KombuException, Exception) as e:
> if hasattr(e, 'exc_type') and hasattr(exc, e.exc_type):
> exc_cls = getattr(exc, e.exc_type)
> raise exc_cls(e.value) ################### This is line 107
>
> _wrap_exception_and_reraise(e)
> ```
>
> At this place Mistral swallows the original exception.
>
> For example, if we got:
>
> ```RemoteError: Remote error: SizeLimitExceededException Size of
> 'params' is 1073KB which exceeds the limit of 1024KB```
>
> we won't see any details about it although this exception could be
> fixed easily just by providing the right configuration option.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mistral/+bug/1750752/+subscriptions

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (master)

Reviewed: https://review.openstack.org/550399
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=3e042238886e9a3640469423bbdf241832233b7e
Submitter: Zuul
Branch: master

commit 3e042238886e9a3640469423bbdf241832233b7e
Author: Renat Akhmerov <email address hidden>
Date: Wed Mar 7 15:48:41 2018 +0700

    Make sure not to swallow original exceptions on handling remote errors

    * Also removed a custom initializer of SizeLimitExceededException with
      3 parameters in favor of creating a static method because we
      have to assume that all MistralException classes have an initializer
      with only one parameter "message" to be able to restore an exception
      on the RPC client which was raised on the RPC server.

    Change-Id: Idd52bb7bb18168826644d8aaca3d96be46f8ae9e
    Closes-Bug: #1750752

Changed in mistral:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to mistral (stable/queens)

Fix proposed to branch: stable/queens
Review: https://review.openstack.org/552870

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to mistral (stable/queens)

Reviewed: https://review.openstack.org/552870
Committed: https://git.openstack.org/cgit/openstack/mistral/commit/?id=eb59183a7965fffba0367a04f25a895fc8577792
Submitter: Zuul
Branch: stable/queens

commit eb59183a7965fffba0367a04f25a895fc8577792
Author: Renat Akhmerov <email address hidden>
Date: Wed Mar 7 15:48:41 2018 +0700

    Make sure not to swallow original exceptions on handling remote errors

    * Also removed a custom initializer of SizeLimitExceededException with
      3 parameters in favor of creating a static method because we
      have to assume that all MistralException classes have an initializer
      with only one parameter "message" to be able to restore an exception
      on the RPC client which was raised on the RPC server.

    Change-Id: Idd52bb7bb18168826644d8aaca3d96be46f8ae9e
    Closes-Bug: #1750752
    (cherry picked from commit 3e042238886e9a3640469423bbdf241832233b7e)

tags: added: in-stable-queens
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 6.0.1

This issue was fixed in the openstack/mistral 6.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/mistral 7.0.0.0b1

This issue was fixed in the openstack/mistral 7.0.0.0b1 development milestone.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.