summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/server
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-31 17:05:17 +0000
commit7723baafa6bad43d9c8abd7c8aeacdf747361cfb (patch)
tree1e67e28b3204271b3936d5d270c7099882ce38c5 /bitbake/lib/bb/server
parent4c5d6edb0b78ea7621d5196e9fcb5585c8fa04a4 (diff)
downloadpoky-7723baafa6bad43d9c8abd7c8aeacdf747361cfb.tar.gz
bitbake: 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. (Bitbake rev: 9cf3102dc36513124fe5ead2f1e448b51833b6ac) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/server')
-rw-r--r--bitbake/lib/bb/server/process.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index 91eb6e0ad9..eba28ad983 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -106,6 +106,7 @@ class ProcessServer():
106 """Register a function to be called while the server is idle""" 106 """Register a function to be called while the server is idle"""
107 assert hasattr(function, '__call__') 107 assert hasattr(function, '__call__')
108 self._idlefuns[function] = data 108 self._idlefuns[function] = data
109 serverlog("Registering idle function %s" % str(function))
109 110
110 def run(self): 111 def run(self):
111 112
@@ -361,6 +362,7 @@ class ProcessServer():
361 try: 362 try:
362 retval = function(self, data, False) 363 retval = function(self, data, False)
363 if retval is False: 364 if retval is False:
365 serverlog("Removing idle function %s" % str(function))
364 del self._idlefuns[function] 366 del self._idlefuns[function]
365 nextsleep = None 367 nextsleep = None
366 elif retval is True: 368 elif retval is True:
@@ -378,6 +380,7 @@ class ProcessServer():
378 if not isinstance(exc, bb.BBHandledException): 380 if not isinstance(exc, bb.BBHandledException):
379 logger.exception('Running idle function') 381 logger.exception('Running idle function')
380 del self._idlefuns[function] 382 del self._idlefuns[function]
383 serverlog("Exception %s broke the idle_thread, exiting" % traceback.format_exc())
381 self.quit = True 384 self.quit = True
382 385
383 # Create new heartbeat event? 386 # Create new heartbeat event?
@@ -395,6 +398,7 @@ class ProcessServer():
395 except Exception as exc: 398 except Exception as exc:
396 if not isinstance(exc, bb.BBHandledException): 399 if not isinstance(exc, bb.BBHandledException):
397 logger.exception('Running heartbeat function') 400 logger.exception('Running heartbeat function')
401 serverlog("Exception %s broke in idle_commands, exiting" % traceback.format_exc())
398 self.quit = True 402 self.quit = True
399 if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: 403 if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat:
400 # Shorten timeout so that we we wake up in time for 404 # Shorten timeout so that we we wake up in time for