All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] event: Improve exception handling
@ 2015-03-10 14:27 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2015-03-10 14:27 UTC (permalink / raw)
  To: bitbake-devel

Currently, if an exception occurs during an event handler execution, 
things can get messy and in many cases the system will loop
indefinitely, particularly if its being triggered through idle handler
code.

This patch changes things so that unhandled exceptions print an error
onto the console/logs, then continue, rather than raising an exception
into "higher" level code which simply can't handle it.

In particular this is more in keeping with the meaning of "Handled"
exceptions. Real world error cases triggering these code paths were much
more stable after these changes than before (which just looped
infinitely printing exceptions).

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index fec6a05..62a8f4f 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -74,17 +74,17 @@ def execute_handler(name, handler, event, d):
     event.data = d
     try:
         ret = handler(event)
-    except (bb.parse.SkipRecipe, bb.BBHandledException):
+    except bb.parse.SkipRecipe:
         raise
+    except bb.BBHandledException:
+        pass
     except Exception:
         etype, value, tb = sys.exc_info()
         logger.error("Execution of event handler '%s' failed" % name,
                         exc_info=(etype, value, tb.tb_next))
-        raise
     except SystemExit as exc:
         if exc.code != 0:
-            logger.error("Execution of event handler '%s' failed" % name)
-        raise
+            logger.error("Execution of event handler '%s' failed (exit code %s)" % (name, exc.code))
     finally:
         del event.data
 




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-03-10 14:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 14:27 [PATCH] event: Improve exception handling Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.