All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] process: Improve traceback error reporting from main loop
@ 2021-08-05 12:37 Richard Purdie
  2021-08-05 12:37 ` [PATCH 2/4] command: Ensure we catch/handle exceptions Richard Purdie
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Richard Purdie @ 2021-08-05 12:37 UTC (permalink / raw)
  To: bitbake-devel

Currently the code can just show nothing as the exception if there was a double
fault, which in this code path is quite likely. This leads to an error log
which effectively says "it failed" with no information about how.

Improve things so we get a nice verbose traceback left in the logs/output
which is preferable to no logs.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/server/process.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index a0955722e3..6127fd40e6 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -26,6 +26,7 @@ import errno
 import re
 import datetime
 import pickle
+import traceback
 import bb.server.xmlrpcserver
 from bb import daemonize
 from multiprocessing import queues
@@ -217,8 +218,9 @@ class ProcessServer():
                     self.command_channel_reply.send(self.cooker.command.runCommand(command))
                     serverlog("Command Completed")
                 except Exception as e:
-                   serverlog('Exception in server main event loop running command %s (%s)' % (command, str(e)))
-                   logger.exception('Exception in server main event loop running command %s (%s)' % (command, str(e)))
+                   stack = traceback.format_exc()
+                   serverlog('Exception in server main event loop running command %s (%s)' % (command, stack))
+                   logger.exception('Exception in server main event loop running command %s (%s)' % (command, stack))
 
             if self.xmlrpc in ready:
                 self.xmlrpc.handle_requests()
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] command: Ensure we catch/handle exceptions
  2021-08-05 12:37 [PATCH 1/4] process: Improve traceback error reporting from main loop Richard Purdie
@ 2021-08-05 12:37 ` Richard Purdie
  2021-08-05 12:37 ` [PATCH 3/4] ui/taskexp: Improve startup exception handling Richard Purdie
  2021-08-05 12:37 ` [PATCH 4/4] ui/taskexp: Fix to work with empty build directories Richard Purdie
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2021-08-05 12:37 UTC (permalink / raw)
  To: bitbake-devel

If an exception occurs in early setup, bitbake could just hang. Return
the exception rather than doing that.

[YOCTO #14408]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/command.py | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/lib/bb/command.py b/lib/bb/command.py
index f530cf844b..a81dcb1366 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -65,9 +65,17 @@ class Command:
 
         # Ensure cooker is ready for commands
         if command != "updateConfig" and command != "setFeatures":
-            self.cooker.init_configdata()
-            if not self.remotedatastores:
-                self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker)
+            try:
+                self.cooker.init_configdata()
+                if not self.remotedatastores:
+                    self.remotedatastores = bb.remotedata.RemoteDatastores(self.cooker)
+            except (Exception, SystemExit) as exc:
+                import traceback
+                if isinstance(exc, bb.BBHandledException):
+                    # We need to start returning real exceptions here. Until we do, we can't
+                    # tell if an exception is an instance of bb.BBHandledException
+                    return None, "bb.BBHandledException()\n" + traceback.format_exc()
+                return None, traceback.format_exc()
 
         if hasattr(CommandsSync, command):
             # Can run synchronous commands straight away
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] ui/taskexp: Improve startup exception handling
  2021-08-05 12:37 [PATCH 1/4] process: Improve traceback error reporting from main loop Richard Purdie
  2021-08-05 12:37 ` [PATCH 2/4] command: Ensure we catch/handle exceptions Richard Purdie
@ 2021-08-05 12:37 ` Richard Purdie
  2021-08-05 12:37 ` [PATCH 4/4] ui/taskexp: Fix to work with empty build directories Richard Purdie
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2021-08-05 12:37 UTC (permalink / raw)
  To: bitbake-devel

When an exception occurs at startup, show it to the user.

[YOCTO #14408]

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

diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
index 2b246710ca..81392977a0 100644
--- a/lib/bb/ui/taskexp.py
+++ b/lib/bb/ui/taskexp.py
@@ -8,6 +8,7 @@
 #
 
 import sys
+import traceback
 
 try:
     import gi
@@ -218,6 +219,9 @@ def main(server, eventHandler, params):
     except client.Fault as x:
         print("XMLRPC Fault getting commandline:\n %s" % x)
         return
+    except Exception as e:
+        print("Exception in startup:\n %s" % traceback.format_exc())
+        return
 
     if gtkthread.quit.isSet():
         return
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] ui/taskexp: Fix to work with empty build directories
  2021-08-05 12:37 [PATCH 1/4] process: Improve traceback error reporting from main loop Richard Purdie
  2021-08-05 12:37 ` [PATCH 2/4] command: Ensure we catch/handle exceptions Richard Purdie
  2021-08-05 12:37 ` [PATCH 3/4] ui/taskexp: Improve startup exception handling Richard Purdie
@ 2021-08-05 12:37 ` Richard Purdie
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2021-08-05 12:37 UTC (permalink / raw)
  To: bitbake-devel

If run on an empty build directory, taskexp wasn't working as it didn't
send the current environment to the server. This means HOSTTOOLS in oe-core
couldn't be built and gave an error. Add the missing updateToServer call in.

[YOCTO #14408]

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/ui/taskexp.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/lib/bb/ui/taskexp.py b/lib/bb/ui/taskexp.py
index 81392977a0..c00eaf6638 100644
--- a/lib/bb/ui/taskexp.py
+++ b/lib/bb/ui/taskexp.py
@@ -197,6 +197,7 @@ def main(server, eventHandler, params):
     gtkgui.start()
 
     try:
+        params.updateToServer(server, os.environ.copy())
         params.updateFromServer(server)
         cmdline = params.parseActions()
         if not cmdline:
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-05 12:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-05 12:37 [PATCH 1/4] process: Improve traceback error reporting from main loop Richard Purdie
2021-08-05 12:37 ` [PATCH 2/4] command: Ensure we catch/handle exceptions Richard Purdie
2021-08-05 12:37 ` [PATCH 3/4] ui/taskexp: Improve startup exception handling Richard Purdie
2021-08-05 12:37 ` [PATCH 4/4] ui/taskexp: Fix to work with empty build directories Richard Purdie

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.