aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-08 13:24:58 +0000
committerAnuj Mittal <anuj.mittal@intel.com>2021-11-16 13:12:38 +0800
commit920111a330be59e5be2068a8f1a9edcbc6c14402 (patch)
treeb2b26aa2708daa47796e4ce5a958d13144a4eb7d
parent693eec8edf8d3b2b01c53be6776213cccd797485 (diff)
downloadbitbake-920111a330be59e5be2068a8f1a9edcbc6c14402.tar.gz
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit dc86a533d951d13643ce446533370da804782afc) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
-rw-r--r--lib/bb/cooker.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 06b40c138..8ae8e4ecc 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2040,6 +2040,7 @@ class Parser(multiprocessing.Process):
result = pending.pop()
else:
try:
+ time.sleep(0.25)
job = self.jobs.pop()
except IndexError:
self.results.close()
@@ -2218,7 +2219,7 @@ class CookerParser(object):
yield not cached, mc, infos
def parse_generator(self):
- while True:
+ while self.processes:
if self.parsed >= self.toparse:
break
@@ -2232,6 +2233,14 @@ class CookerParser(object):
raise value
else:
yield result
+ for process in self.processes.copy():
+ if not process.is_alive():
+ process.join()
+ self.processes.remove(process)
+
+ if not (self.parsed >= self.toparse):
+ raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None)
+
def parse_next(self):
result = []