All of lore.kernel.org
 help / color / mirror / Atom feed
* runqueue.py: Gracefully handle a missing worker process
@ 2014-03-09 17:01 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2014-03-09 17:01 UTC (permalink / raw)
  To: bitbake-devel

If the worker has already gone missing (e.g. SIGTERM), we should
gracefully handle the write failures at exit time rather than throwing
ugly tracebacks.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 967e944..7d3e91a 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -900,8 +900,11 @@ class RunQueue:
         if not worker:
             return
         logger.debug(1, "Teardown for bitbake-worker")
-        worker.stdin.write("<quit></quit>")
-        worker.stdin.flush()
+        try:
+           worker.stdin.write("<quit></quit>")
+           worker.stdin.flush()
+        except IOError:
+           pass
         while worker.returncode is None:
             workerpipe.read()
             worker.poll()
@@ -1275,11 +1278,15 @@ class RunQueueExecute:
 
     def finish_now(self):
 
-        self.rq.worker.stdin.write("<finishnow></finishnow>")
-        self.rq.worker.stdin.flush()
-        if self.rq.fakeworker:
-            self.rq.fakeworker.stdin.write("<finishnow></finishnow>")
-            self.rq.fakeworker.stdin.flush()
+        for worker in [self.rq.worker, self.rq.fakeworker]:
+            if not worker:
+                continue
+            try:
+                worker.stdin.write("<finishnow></finishnow>")
+                worker.stdin.flush()
+            except IOError:
+                # worker must have died?
+                pass
 
         if len(self.failed_fnids) != 0:
             self.rq.state = runQueueFailed




^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-09 17:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-09 17:01 runqueue.py: Gracefully handle a missing worker process 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.