summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-30 20:39:53 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-05 08:14:50 +0100
commit733afeffd19a2ae3af34abe95e514cb4b99cd366 (patch)
tree7c08eda1337172bc8331719f4193d4fe669317ca /bitbake
parent7e6d7315f9cbc71d085b83f4d5f549e763671951 (diff)
downloadpoky-733afeffd19a2ae3af34abe95e514cb4b99cd366.tar.gz
bitbake: server/process: Add more timing debug
It is helpful to have timestamps on the ping failures so that they can be matched against the bitbake logs. It is also useful to understand how long the server takes for form a reply verses when it is sent. (Bitbake rev: 65969a7a8f5ae22c230431d2db080eb187a27708) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/server/process.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index f62faed000..40cb99bc97 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -38,8 +38,11 @@ logger = logging.getLogger('BitBake')
38class ProcessTimeout(SystemExit): 38class ProcessTimeout(SystemExit):
39 pass 39 pass
40 40
41def currenttime():
42 return datetime.datetime.now().strftime('%H:%M:%S.%f')
43
41def serverlog(msg): 44def serverlog(msg):
42 print(str(os.getpid()) + " " + datetime.datetime.now().strftime('%H:%M:%S.%f') + " " + msg) 45 print(str(os.getpid()) + " " + currenttime() + " " + msg)
43 sys.stdout.flush() 46 sys.stdout.flush()
44 47
45# 48#
@@ -289,7 +292,9 @@ class ProcessServer():
289 continue 292 continue
290 try: 293 try:
291 serverlog("Running command %s" % command) 294 serverlog("Running command %s" % command)
292 self.command_channel_reply.send(self.cooker.command.runCommand(command, self)) 295 reply = self.cooker.command.runCommand(command, self)
296 serverlog("Sending reply %s" % repr(reply))
297 self.command_channel_reply.send(reply)
293 serverlog("Command Completed (socket: %s)" % os.path.exists(self.sockname)) 298 serverlog("Command Completed (socket: %s)" % os.path.exists(self.sockname))
294 except Exception as e: 299 except Exception as e:
295 stack = traceback.format_exc() 300 stack = traceback.format_exc()
@@ -502,9 +507,9 @@ class ServerCommunicator():
502 def runCommand(self, command): 507 def runCommand(self, command):
503 self.connection.send(command) 508 self.connection.send(command)
504 if not self.recv.poll(30): 509 if not self.recv.poll(30):
505 logger.info("No reply from server in 30s (for command %s)" % command[0]) 510 logger.info("No reply from server in 30s (for command %s at %s)" % (command[0], currenttime()))
506 if not self.recv.poll(30): 511 if not self.recv.poll(30):
507 raise ProcessTimeout("Timeout while waiting for a reply from the bitbake server (60s)") 512 raise ProcessTimeout("Timeout while waiting for a reply from the bitbake server (60s at %s)" % currenttime())
508 ret, exc = self.recv.get() 513 ret, exc = self.recv.get()
509 # Should probably turn all exceptions in exc back into exceptions? 514 # Should probably turn all exceptions in exc back into exceptions?
510 # For now, at least handle BBHandledException 515 # For now, at least handle BBHandledException