API exceptions are not logged

Bug #1229292 reported by Steven Hardy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Heat
Fix Released
High
Zane Bitter

Bug Description

It appears that all API errors now fail to log anything. This seems to affect the CFN and native ReST API's.

The native API is using the faultwrap middleware, which doesn't log anything, so we can add logging there, but I'm not sure where we need to add it for the CFN API as the default paste pipeline doesn't use faultwrap.

This can be reproduced by putting a raise Exception() somewhere in the API code, nothing is logged, although with debugging enabled the ReST API returns a JSON-formatted traceback via the API.

Steven Hardy (shardy)
Changed in heat:
status: New → Triaged
importance: Undecided → High
milestone: none → havana-rc1
assignee: nobody → Steven Hardy (shardy)
Steven Hardy (shardy)
Changed in heat:
assignee: Steven Hardy (shardy) → nobody
Steven Hardy (shardy)
Changed in heat:
assignee: nobody → Steven Hardy (shardy)
Revision history for this message
Steven Hardy (shardy) wrote :

Hmm, this is actually not that simple:

in the api/middleware/fault.py code we have this:

        if ex_type.endswith(rpc_common._REMOTE_POSTFIX):
            ex_type = ex_type[:-len(rpc_common._REMOTE_POSTFIX)]
            remote_error = True

However, if for example you do raise Exception("foo") in the engine, the ex_type is just "Exception":

SHDEBUG ex_type = Exception
SHDEBUG rpc_common._REMOTE_POSTFIX = _Remote

So it would appear we've got no way to detect if this is a local or remote error, hence whether we should log the trace for the local error or not. Sigh.

Zane Bitter (zaneb)
Changed in heat:
assignee: Steven Hardy (shardy) → Zane Bitter (zaneb)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to heat (master)

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

Changed in heat:
status: Triaged → In Progress
Revision history for this message
Thierry Carrez (ttx) wrote :
Changed in heat:
status: In Progress → Fix Committed
status: Fix Committed → In Progress
Revision history for this message
Thierry Carrez (ttx) wrote :

oops wrong bug

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

Reviewed: https://review.openstack.org/49155
Committed: http://github.com/openstack/heat/commit/7c1cb04eefc968b6b352c24d2ac8b10800766a18
Submitter: Jenkins
Branch: master

commit 7c1cb04eefc968b6b352c24d2ac8b10800766a18
Author: Zane Bitter <email address hidden>
Date: Tue Oct 1 15:49:27 2013 +0200

    Log exception traces in APIs

    Fixes bug: #1229292

    Change-Id: I3b87c63cf1dc0100e34418b588d215a6e61e2ad1

Changed in heat:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in heat:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in heat:
milestone: havana-rc1 → 2013.2
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.