All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH 2/6] cooker: Fix main loop starvation when parsing
Date: Sat, 26 Mar 2022 20:34:54 +0000	[thread overview]
Message-ID: <20220326203458.1391301-2-richard.purdie@linuxfoundation.org> (raw)
In-Reply-To: <20220326203458.1391301-1-richard.purdie@linuxfoundation.org>

When parsing, the parser isn't servicing the main loop so a Ctrl+C in the
UI won't be seen on the cooker/server side. Fix this by returning when queue
timeouts occur. This helps where there is a hung or slow parsing thread.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/cooker.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index c4d720a6b6..fb71a968f2 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -2249,7 +2249,7 @@ class CookerParser(object):
                 result = self.result_queue.get(timeout=0.25)
             except queue.Empty:
                 empty = True
-                pass
+                yield None, None, None
             else:
                 empty = False
                 yield result
@@ -2266,6 +2266,10 @@ class CookerParser(object):
             if isinstance(result, BaseException):
                 # Turn exceptions back into exceptions
                 raise result
+            if parsed is None:
+                # Timeout, loop back through the main loop
+                return True
+
         except StopIteration:
             self.shutdown()
             return False
-- 
2.32.0



  reply	other threads:[~2022-03-26 20:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-26 20:34 [PATCH 1/6] cooker: Fix exception handling in parsers Richard Purdie
2022-03-26 20:34 ` Richard Purdie [this message]
2022-03-26 20:34 ` [PATCH 3/6] cooker: Improve exception handling in parsing process Richard Purdie
2022-03-26 20:34 ` [PATCH 4/6] server/process: Avoid hanging if a parser process is terminated Richard Purdie
2022-03-26 20:34 ` [PATCH 5/6] cooker: Ensure parsing processes have close called Richard Purdie
2022-03-26 20:34 ` [PATCH 6/6] cooker: Pass SIGINT to parsing processes at shutdown Richard Purdie
     [not found] ` <16E008969DDF9BDD.32521@lists.openembedded.org>
2022-03-28 10:01   ` [bitbake-devel] [PATCH 4/6] server/process: Avoid hanging if a parser process is terminated Richard Purdie
2022-03-29 14:27 [PATCH 1/6] cooker: Fix exception handling in parsers Richard Purdie
2022-03-29 14:27 ` [PATCH 2/6] cooker: Fix main loop starvation when parsing Richard Purdie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220326203458.1391301-2-richard.purdie@linuxfoundation.org \
    --to=richard.purdie@linuxfoundation.org \
    --cc=bitbake-devel@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.