summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-10 11:29:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-11-21 11:35:41 +0000
commit6108762d0217168b52d0ac730802d26a53042699 (patch)
treeb24eef2e1fdbc13a9fe7ac663a2fe5482b15e022
parentfe1583b445a20bea06e9e7afa4484d11cac41297 (diff)
downloadpoky-6108762d0217168b52d0ac730802d26a53042699.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: 8eaddb92a5fd14de6b5995aa92a6eed03b90a252) 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 9be6603f31..c032762f8d 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -2218,24 +2218,28 @@ class CookerParser(object):
2218 yield not cached, mc, infos 2218 yield not cached, mc, infos
2219 2219
2220 def parse_generator(self): 2220 def parse_generator(self):
2221 while self.processes: 2221 empty = False
2222 while self.processes or not empty:
2223 for process in self.processes.copy():
2224 if not process.is_alive():
2225 process.join()
2226 self.processes.remove(process)
2227
2222 if self.parsed >= self.toparse: 2228 if self.parsed >= self.toparse:
2223 break 2229 break
2224 2230
2225 try: 2231 try:
2226 result = self.result_queue.get(timeout=0.25) 2232 result = self.result_queue.get(timeout=0.25)
2227 except queue.Empty: 2233 except queue.Empty:
2234 empty = True
2228 pass 2235 pass
2229 else: 2236 else:
2237 empty = False
2230 value = result[1] 2238 value = result[1]
2231 if isinstance(value, BaseException): 2239 if isinstance(value, BaseException):
2232 raise value 2240 raise value
2233 else: 2241 else:
2234 yield result 2242 yield result
2235 for process in self.processes.copy():
2236 if not process.is_alive():
2237 process.join()
2238 self.processes.remove(process)
2239 2243
2240 if not (self.parsed >= self.toparse): 2244 if not (self.parsed >= self.toparse):
2241 raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None) 2245 raise bb.parse.ParseError("Not all recipes parsed, parser thread killed/died? Exiting.", None)