From b7173ca2254421c45f01243a77be611fe4b9d1c5 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 16 Jul 2025 16:14:04 +0100 Subject: [PATCH] bitbake: event: Fix an event duplication race It is possible for multple bitbake threads to empty ui_queue in parallel leading to duplicate console messages and much confusion when debuging. Use the lock to extract the queue data which means only one thread will processing, removing the duplicate out of order messages. (Bitbake rev: 945095602e40d54efb8de494218f4a2b25c9969f) Signed-off-by: Richard Purdie --- bitbake/lib/bb/event.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index b29f0a5568..2256fed764 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -236,9 +236,12 @@ def fire(event, d): # If messages have been queued up, clear the queue global _uiready, ui_queue if _uiready and ui_queue: - for queue_event in ui_queue: + with bb.utils.lock_timeout_nocheck(_thread_lock): + queue = ui_queue + ui_queue = [] + for queue_event in queue: fire_ui_handlers(queue_event, d) - ui_queue = [] + fire_ui_handlers(event, d) def fire_from_worker(event, d):