Change in vdsm[ovirt-3.3]: utils: Add unhandled exceptions logging decorator

ybronhei at redhat.com ybronhei at redhat.com
Wed Dec 11 11:25:07 UTC 2013


Yaniv Bronhaim has submitted this change and it was merged.

Change subject: utils: Add unhandled exceptions logging decorator
......................................................................


utils: Add unhandled exceptions logging decorator

We have at least two places where exceptions in thread main function are
not handled, making debugging such threads impossible. This patch adds a
new decorator that make it easy to log tracebacks for unhandled
exceptions.

The recommended use case is to decorate a thread main function. This
ensure that we get a traceback for any error in the thread, including
errors in error handling code. This should be used on all in threads in
the system.

Note that the decorator only adds logging - it does not change the
program flow.  The unhandled exception is raise again so you can safely
use it on script main function, without changing the exit code. Do not
try to use this for ignoring exceptions.

See utilsTests for example usage.

Change-Id: I39265bac4f26fefa365bad080dafb6106145f846
Relates-To: https://bugzilla.redhat.com/1034741
Relates-To: https://bugzilla.redhat.com/1040164
Relates-To: https://bugzilla.redhat.com/1040166
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/21778
Reviewed-by: Sergey Gotliv <sgotliv at redhat.com>
Reviewed-by: Dan Kenigsberg <danken at redhat.com>
Reviewed-on: http://gerrit.ovirt.org/22212
Reviewed-by: Yaniv Bronhaim <ybronhei at redhat.com>
Tested-by: Yaniv Bronhaim <ybronhei at redhat.com>
---
M lib/vdsm/utils.py
M tests/utilsTests.py
2 files changed, 82 insertions(+), 0 deletions(-)

Approvals:
  Yaniv Bronhaim: Verified; Looks good to me, approved



-- 
To view, visit http://gerrit.ovirt.org/22212
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I39265bac4f26fefa365bad080dafb6106145f846
Gerrit-PatchSet: 4
Gerrit-Project: vdsm
Gerrit-Branch: ovirt-3.3
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Allon Mureinik <amureini at redhat.com>
Gerrit-Reviewer: Dan Kenigsberg <danken at redhat.com>
Gerrit-Reviewer: Federico Simoncelli <fsimonce at redhat.com>
Gerrit-Reviewer: Nir Soffer <nsoffer at redhat.com>
Gerrit-Reviewer: Sergey Gotliv <sgotliv at redhat.com>
Gerrit-Reviewer: Yaniv Bronhaim <ybronhei at redhat.com>


More information about the vdsm-patches mailing list