[bitbake-devel,2/2] cooker: ensure graceful exit after exception during BuildCompleted handler

Submitted by Paul Eggleton on June 14, 2017, 10:10 a.m. | Patch ID: 140819

Details

Message ID be5e5d97538e3ab7e946ed144c24674e2d62c4b8.1497434991.git.paul.eggleton@linux.intel.com
State New
Headers show

Commit Message

Paul Eggleton June 14, 2017, 10:10 a.m.
If an event handler for bb.event.BuildCompleted fails, we still need to
call finishAsyncCommand() or else BitBake will just exit immediately
without showing any error summary, or worse in the case of memory
resident mode BitBake will hang and if you Ctrl+C to break out, the
command won't be marked as finished which means that no further commands
will be able to be executed until the server is manually restarted.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 lib/bb/cooker.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 6a1b649..479dc5a 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1361,8 +1361,10 @@  class BBCooker:
                 return False
 
             if not retval:
-                bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.data)
-                self.command.finishAsyncCommand(msg)
+                try:
+                    bb.event.fire(bb.event.BuildCompleted(len(rq.rqdata.runtaskentries), buildname, targets, failures, interrupted), self.data)
+                finally:
+                    self.command.finishAsyncCommand(msg)
                 return False
             if retval is True:
                 return True