From 72072db00465595293eda7b9b5446fcabef6552a Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 21 Jan 2023 19:29:51 +0000 Subject: bitbake: cooker: Fix parsing race around cache handling When draining the result queue from the parsing processes, cache objects can be created even if they are then immediately destroyed. The reset in the sync code needs to happen after any objects have been created. Change the ordering to fix this. This ordering has caused various cache errors, particularly when interrupting parsing with Ctrl+C. (Bitbake rev: f45a94e6720dacf7f51ac147c115a6f608769093) Signed-off-by: Richard Purdie --- bitbake/lib/bb/cooker.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 709e69493d..f28951cce5 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -2230,6 +2230,14 @@ class CookerParser(object): else: bb.error("Parsing halted due to errors, see error messages above") + # Cleanup the queue before call process.join(), otherwise there might be + # deadlocks. + while True: + try: + self.result_queue.get(timeout=0.25) + except queue.Empty: + break + def sync_caches(): for c in self.bb_caches.values(): bb.cache.SiggenRecipeInfo.reset() @@ -2240,14 +2248,6 @@ class CookerParser(object): self.parser_quit.set() - # Cleanup the queue before call process.join(), otherwise there might be - # deadlocks. - while True: - try: - self.result_queue.get(timeout=0.25) - except queue.Empty: - break - for process in self.processes: process.join(0.5) -- cgit v1.2.3-54-g00ecf