event: Clear ui_queue after handling it
PATCH 1/3 event: Clear ui_queue after handling it
--- lib/bb/event.py | 2 ++ 1 file changed, 2 insertions(+)
lib/bb/event.py +2 -0
@@ -124,6 +124,7 @@ def fire_class_handlers(event, d): ui_queue = [] @atexit.register def print_ui_queue(): + global ui_queue """If we're exiting before a UI has been spawned, display any queued LogRecords to the console.""" logger = logging.getLogger("BitBake")
@@ -168,6 +169,7 @@ def print_ui_queue(): logger.removeHandler(stderr) else: logger.removeHandler(stdout) + ui_queue = [] def fire_ui_handlers(event, d): global _thread_lock
Signature · 1 line
2.20.1
PATCH 2/3 main: Ensure log messages are printed when no UI starts
If the UI hasn't started, no messages are printed to the console until the server starts. This is confusing, particularly if the server never starts. Flush the UI queue through the simply handler upon connection retry so the user sees the messages they're supposed to be seeing.
Also point the user at the logfile for hints about why this may be.
--- lib/bb/main.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/bb/main.py +2 -1
@@ -468,7 +468,8 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): else: logger.info("Retrying server connection (#%d)... (%s)" % (tryno, traceback.format_exc())) if not retries: - bb.fatal("Unable to connect to bitbake server, or start one") + bb.fatal("Unable to connect to bitbake server, or start one (server startup failures would be in bitbake-cookerdaemon.log).") + bb.event.print_ui_queue() if retries < 5: time.sleep(5)
Signature · 1 line
2.20.1
PATCH 3/3 main: Alter EOFError handling
In reply to Richard PurdieIf the server shuts down 'cleanly' due to some issue, the socket will close. A recently reported example was an invalid PRSERV being set. Doing this silently and without changing the retries count will case the server startup to loop infinitely.
Change the code so it triggers the usual retries note messages and times out eventually pointing the user at the cooker log file.
[YOCTO #12984]
--- lib/bb/main.py | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
lib/bb/main.py +2 -7
@@ -447,12 +447,7 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): bb.utils.unlockfile(lock) raise bb.server.process.ProcessTimeout("Bitbake still shutting down as socket exists but no lock?") if not configParams.server_only: - try: - server_connection = bb.server.process.connectProcessServer(sockname, featureset) - except EOFError: - # The server may have been shutting down but not closed the socket yet. If that happened, - # ignore it. - pass + server_connection = bb.server.process.connectProcessServer(sockname, featureset) if server_connection or configParams.server_only: break
@@ -463,7 +458,7 @@ def setup_bitbake(configParams, configuration, extrafeatures=None): raise retries -= 1 tryno = 8 - retries - if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError)): + if isinstance(e, (bb.server.process.ProcessTimeout, BrokenPipeError, EOFError)): logger.info("Retrying server connection (#%d)..." % tryno) else: logger.info("Retrying server connection (#%d)... (%s)" % (tryno, traceback.format_exc()))
Signature · 1 line
2.20.1