summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-22 10:24:46 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-24 10:08:28 +0000
commitf39f01dee7593280803497659df99b02556987ff (patch)
treeb9df3e67335785698cb6f8842c43143a377cf4dc
parent03df18316968797ec594eed4332a1d0745344bb4 (diff)
downloadpoky-f39f01dee7593280803497659df99b02556987ff.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: 6e746ccf8977a78f1565c6b2fe65aaede260e1bb) 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>
-rw-r--r--bitbake/lib/bb/cooker.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index b041d2a06b..f12f4caa05 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -2036,6 +2036,7 @@ class Parser(multiprocessing.Process):
2036 result = pending.pop() 2036 result = pending.pop()
2037 else: 2037 else:
2038 try: 2038 try:
2039 time.sleep(0.25)
2039 job = self.jobs.pop() 2040 job = self.jobs.pop()
2040 except IndexError: 2041 except IndexError:
2041 self.results.close() 2042 self.results.close()
@@ -2214,7 +2215,7 @@ class CookerParser(object):
2214 yield not cached, mc, infos 2215 yield not cached, mc, infos
2215 2216
2216 def parse_generator(self): 2217 def parse_generator(self):
2217 while True: 2218 while self.processes:
2218 if self.parsed >= self.toparse: 2219 if self.parsed >= self.toparse:
2219 break 2220 break
2220 2221
@@ -2228,6 +2229,14 @@ class CookerParser(object):
2228 raise value 2229 raise value
2229 else: 2230 else:
2230 yield result 2231 yield result
2232 for process in self.processes.copy():
2233 if not process.is_alive():
2234 process.join()
2235 self.processes.remove(process)
2236
2237 if not (self.parsed >= self.toparse):
2238 raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None)
2239
2231 2240
2232 def parse_next(self): 2241 def parse_next(self):
2233 result = [] 2242 result = []