aboutsummaryrefslogtreecommitdiffstats
path: root/lib
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:02 +0000
commit4a06b2fa37648204cab41a5cbfb6fa217aa32686 (patch)
tree5428b7a68ffd46853c920b13e54d9b1c8c5f16c3 /lib
parent2213871444d03ba6e78b13256aeae3fa958c2b2a (diff)
downloadbitbake-4a06b2fa37648204cab41a5cbfb6fa217aa32686.tar.gz
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. 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>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/cooker.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index c952c5748..e2a5dc43a 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2214,24 +2214,28 @@ class CookerParser(object):
yield not cached, mc, infos
def parse_generator(self):
- while self.processes:
+ empty = False
+ while self.processes or not empty:
+ for process in self.processes.copy():
+ if not process.is_alive():
+ process.join()
+ self.processes.remove(process)
+
if self.parsed >= self.toparse:
break
try:
result = self.result_queue.get(timeout=0.25)
except queue.Empty:
+ empty = True
pass
else:
+ empty = False
value = result[1]
if isinstance(value, BaseException):
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)