summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-22 10:24:48 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-24 10:08:28 +0000
commite1b119ca21584fea5ba7076d9027d9154b6cbc4f (patch)
tree4c3f25d44c7c368ef62ab5b29caed5acaa856c70
parentad2459fc1d4f640ab298d0eba1b4efa88970edb4 (diff)
downloadpoky-e1b119ca21584fea5ba7076d9027d9154b6cbc4f.tar.gz
bitbake: cooker: Handle parsing results queue race
The previous fix introduced a race where the queue might not be empty but all the parser processes have exited. Handle this correctly to avoid occasional errors. (Bitbake rev: 4a06b2fa37648204cab41a5cbfb6fa217aa32686) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 8e7f2b6500e26610f52d128b48ca0a09bf6fb2cb) 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.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index c952c57483..e2a5dc43a9 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -2214,24 +2214,28 @@ class CookerParser(object):
2214 yield not cached, mc, infos 2214 yield not cached, mc, infos
2215 2215
2216 def parse_generator(self): 2216 def parse_generator(self):
2217 while self.processes: 2217 empty = False
2218 while self.processes or not empty:
2219 for process in self.processes.copy():
2220 if not process.is_alive():
2221 process.join()
2222 self.processes.remove(process)
2223
2218 if self.parsed >= self.toparse: 2224 if self.parsed >= self.toparse:
2219 break 2225 break
2220 2226
2221 try: 2227 try:
2222 result = self.result_queue.get(timeout=0.25) 2228 result = self.result_queue.get(timeout=0.25)
2223 except queue.Empty: 2229 except queue.Empty:
2230 empty = True
2224 pass 2231 pass
2225 else: 2232 else:
2233 empty = False
2226 value = result[1] 2234 value = result[1]
2227 if isinstance(value, BaseException): 2235 if isinstance(value, BaseException):
2228 raise value 2236 raise value
2229 else: 2237 else:
2230 yield result 2238 yield result
2231 for process in self.processes.copy():
2232 if not process.is_alive():
2233 process.join()
2234 self.processes.remove(process)
2235 2239
2236 if not (self.parsed >= self.toparse): 2240 if not (self.parsed >= self.toparse):
2237 raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None) 2241 raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None)