diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-23 11:09:07 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-23 11:09:07 +0000 |
commit | 56a92105fe6b779c69bccd44c2cff8f21cafdfbd (patch) | |
tree | 22d4d5c8b1d62cadab09a844d0bc1eaef5e54595 /bitbake/lib | |
parent | c0f0a8ee0cac5b6dd7c7a7e584309f862e49f536 (diff) | |
download | poky-56a92105fe6b779c69bccd44c2cff8f21cafdfbd.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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 825c357988..ff16daf83f 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -948,6 +948,13 @@ class CookerExit(bb.event.Event): | |||
948 | def __init__(self): | 948 | def __init__(self): |
949 | bb.event.Event.__init__(self) | 949 | bb.event.Event.__init__(self) |
950 | 950 | ||
951 | class ParsingFailure(Exception): | ||
952 | def __init__(self, realexception, recipe): | ||
953 | self.realexception = realexception | ||
954 | self.recipe = recipe | ||
955 | Exception.__init__(self, "Failure when parsing %s" % recipe) | ||
956 | self.args = (realexception, recipe) | ||
957 | |||
951 | def parse_file(task): | 958 | def parse_file(task): |
952 | filename, appends = task | 959 | filename, appends = task |
953 | try: | 960 | try: |
@@ -955,6 +962,11 @@ def parse_file(task): | |||
955 | except Exception, exc: | 962 | except Exception, exc: |
956 | exc.recipe = filename | 963 | exc.recipe = filename |
957 | raise exc | 964 | raise exc |
965 | # Need to turn BaseExceptions into Exceptions here so we gracefully shutdown | ||
966 | # and for example a worker thread doesn't just exit on its own in response to | ||
967 | # a SystemExit event for example. | ||
968 | except BaseException, exc: | ||
969 | raise ParsingFailure(exc, filename) | ||
958 | 970 | ||
959 | class CookerParser(object): | 971 | class CookerParser(object): |
960 | def __init__(self, cooker, filelist, masked): | 972 | def __init__(self, cooker, filelist, masked): |