diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-16 16:14:04 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-07-17 10:45:57 +0100 |
| commit | b7173ca2254421c45f01243a77be611fe4b9d1c5 (patch) | |
| tree | 8af6a3cfd3eb7005acced43caeb23b703541146d /bitbake/lib/bb/event.py | |
| parent | e16dd314450cb2b85e4984c17fa60403b662ef8c (diff) | |
| download | poky-b7173ca2254421c45f01243a77be611fe4b9d1c5.tar.gz | |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/event.py')
| -rw-r--r-- | bitbake/lib/bb/event.py | 7 |
1 files 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): | |||
| 236 | # If messages have been queued up, clear the queue | 236 | # If messages have been queued up, clear the queue |
| 237 | global _uiready, ui_queue | 237 | global _uiready, ui_queue |
| 238 | if _uiready and ui_queue: | 238 | if _uiready and ui_queue: |
| 239 | for queue_event in ui_queue: | 239 | with bb.utils.lock_timeout_nocheck(_thread_lock): |
| 240 | queue = ui_queue | ||
| 241 | ui_queue = [] | ||
| 242 | for queue_event in queue: | ||
| 240 | fire_ui_handlers(queue_event, d) | 243 | fire_ui_handlers(queue_event, d) |
| 241 | ui_queue = [] | 244 | |
| 242 | fire_ui_handlers(event, d) | 245 | fire_ui_handlers(event, d) |
| 243 | 246 | ||
| 244 | def fire_from_worker(event, d): | 247 | def fire_from_worker(event, d): |
