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 <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie
2023-01-21 19:29:51 +00:00
parent 4a94cf21c5
commit 72072db004

View File

@@ -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)