]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake/cooker: Fix parsing failure zombie problem
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 23 Feb 2011 11:09:07 +0000 (11:09 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 24 Feb 2011 21:38:08 +0000 (21:38 +0000)
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>
lib/bb/cooker.py

index 70d1ae3eeac8c8f20743b22effec0c7681e3e029..01c0a488eb648ecdb68676290525083d61645799 100644 (file)
@@ -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):