Comment 5 for bug 1881455

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

Reviewed: https://review.opendev.org/733668
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=125df26bf9d6b4cfbfb68770fa47f2055f29b8dc
Submitter: Zuul
Branch: master

commit 125df26bf9d6b4cfbfb68770fa47f2055f29b8dc
Author: Stephen Finucane <email address hidden>
Date: Thu Jun 4 12:13:56 2020 +0100

    Use 'Exception.__traceback__' for versioned notifications

    The 'inspect.trace()' function is expected to be called within the
    context of an exception handler. The 'from_exc_and_traceback' class
    method of the 'nova.notification.objects.exception.ExceptionPayload'
    class uses this to get information about a provided exception, however,
    there are cases where this is called from outside of an exception
    handler. In these cases, we see an 'IndexError' since we can't get the
    last frame of a non-existent stacktrace. The solution to this is to
    fallback to using the traceback embedded in the exception. This is a bit
    lossy when decorators are involved but for all other cases this will
    give us the same information. This also allows us to avoid passing a
    traceback argument to the function since we have it to hand already.

    Change-Id: I404ca316b1bf2a963106cd34e927934befbd9b12
    Signed-off-by: Stephen Finucane <email address hidden>
    Closes-Bug: #1881455