summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-23 11:09:07 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-24 21:38:08 +0000
commitfc701f08717d1d066f1ceaa0743821e3c03589cd (patch)
tree9045293e746083c06d106c0a84fec0eaf8c8e5b7
parentff3ac7274fd1e07ab6ebf25e259572ffcd2da2e9 (diff)
downloadbitbake-fc701f08717d1d066f1ceaa0743821e3c03589cd.tar.gz
bitbake/cooker: Fix parsing failure zombie problem
When parsing if a SystemExit event is triggered, it causes the parsing thread to exit and the main process hangs waiting for it to finish indefintely. Add code to catch BaseExceptions and raise these with the main process gracefully instead of just hanging indefinitely with zombie processes. (From Poky rev: 56a92105fe6b779c69bccd44c2cff8f21cafdfbd) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/cooker.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 70d1ae3ee..01c0a488e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -902,6 +902,13 @@ class CookerExit(bb.event.Event):
def __init__(self):
bb.event.Event.__init__(self)
+class ParsingFailure(Exception):
+ def __init__(self, realexception, recipe):
+ self.realexception = realexception
+ self.recipe = recipe
+ Exception.__init__(self, "Failure when parsing %s" % recipe)
+ self.args = (realexception, recipe)
+
def parse_file(task):
filename, appends = task
try:
@@ -909,6 +916,11 @@ def parse_file(task):
except Exception, exc:
exc.recipe = filename
raise exc
+ # Need to turn BaseExceptions into Exceptions here so we gracefully shutdown
+ # and for example a worker thread doesn't just exit on its own in response to
+ # a SystemExit event for example.
+ except BaseException, exc:
+ raise ParsingFailure(exc, filename)
class CookerParser(object):
def __init__(self, cooker, filelist, masked):