aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/server/process.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-30 21:42:29 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-30 21:42:29 +0000
commit9cf3102dc36513124fe5ead2f1e448b51833b6ac (patch)
tree4e38c24594eee8ad29c0ef3439629b691e99abab /lib/bb/server/process.py
parent5f8b9b9c35b4ec0c8c539bf54ca85f068f4a5094 (diff)
downloadbitbake-9cf3102dc36513124fe5ead2f1e448b51833b6ac.tar.gz
server/process: Improve exception and idle function logging
Currently if the idle functions loop suffers a traceback, it is silently dropped and there is no log message to say what happened. This change at least means the traceback is in the cooker log, making some debugging possible. Add some logging to show when handlers are added/removed to allow a better idea of what the server code is doing from the server log file. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server/process.py')
-rw-r--r--lib/bb/server/process.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 91eb6e0ad..eba28ad98 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -106,6 +106,7 @@ class ProcessServer():
"""Register a function to be called while the server is idle"""
assert hasattr(function, '__call__')
self._idlefuns[function] = data
+ serverlog("Registering idle function %s" % str(function))
def run(self):
@@ -361,6 +362,7 @@ class ProcessServer():
try:
retval = function(self, data, False)
if retval is False:
+ serverlog("Removing idle function %s" % str(function))
del self._idlefuns[function]
nextsleep = None
elif retval is True:
@@ -378,6 +380,7 @@ class ProcessServer():
if not isinstance(exc, bb.BBHandledException):
logger.exception('Running idle function')
del self._idlefuns[function]
+ serverlog("Exception %s broke the idle_thread, exiting" % traceback.format_exc())
self.quit = True
# Create new heartbeat event?
@@ -395,6 +398,7 @@ class ProcessServer():
except Exception as exc:
if not isinstance(exc, bb.BBHandledException):
logger.exception('Running heartbeat function')
+ serverlog("Exception %s broke in idle_commands, exiting" % traceback.format_exc())
self.quit = True
if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat:
# Shorten timeout so that we we wake up in time for