diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-08 13:24:58 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-11-21 11:35:41 +0000 |
commit | e180b85efb9150a9ad678addb197e86823a46e96 (patch) | |
tree | 97c59ea63fb208bef7484d90e0c61acc4f96b40f /bitbake | |
parent | da5d1b540e052c862232f8bd464d30bb387fe86e (diff) | |
download | poky-e180b85efb9150a9ad678addb197e86823a46e96.tar.gz |
bitbake: cooker: Handle parse threads disappearing to avoid hangs
If one of the parse threads disappears during parsing for some reason, bitbake
currently hangs. Avoid this (and zombie threads hanging around) by joining()
threads which have exited.
(Bitbake rev: 920111a330be59e5be2068a8f1a9edcbc6c14402)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit dc86a533d951d13643ce446533370da804782afc)
Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 06b40c138b..8ae8e4ecc7 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -2040,6 +2040,7 @@ class Parser(multiprocessing.Process): | |||
2040 | result = pending.pop() | 2040 | result = pending.pop() |
2041 | else: | 2041 | else: |
2042 | try: | 2042 | try: |
2043 | time.sleep(0.25) | ||
2043 | job = self.jobs.pop() | 2044 | job = self.jobs.pop() |
2044 | except IndexError: | 2045 | except IndexError: |
2045 | self.results.close() | 2046 | self.results.close() |
@@ -2218,7 +2219,7 @@ class CookerParser(object): | |||
2218 | yield not cached, mc, infos | 2219 | yield not cached, mc, infos |
2219 | 2220 | ||
2220 | def parse_generator(self): | 2221 | def parse_generator(self): |
2221 | while True: | 2222 | while self.processes: |
2222 | if self.parsed >= self.toparse: | 2223 | if self.parsed >= self.toparse: |
2223 | break | 2224 | break |
2224 | 2225 | ||
@@ -2232,6 +2233,14 @@ class CookerParser(object): | |||
2232 | raise value | 2233 | raise value |
2233 | else: | 2234 | else: |
2234 | yield result | 2235 | yield result |
2236 | for process in self.processes.copy(): | ||
2237 | if not process.is_alive(): | ||
2238 | process.join() | ||
2239 | self.processes.remove(process) | ||
2240 | |||
2241 | if not (self.parsed >= self.toparse): | ||
2242 | raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None) | ||
2243 | |||
2235 | 2244 | ||
2236 | def parse_next(self): | 2245 | def parse_next(self): |
2237 | result = [] | 2246 | result = [] |