]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: runqueue.py: Gracefully handle a missing worker process
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 9 Mar 2014 17:01:19 +0000 (10:01 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 10 Mar 2014 18:09:58 +0000 (11:09 -0700)
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.

(Bitbake rev: 1b1672e1ceff17fc4ff8eb7aa46f59fce3593873)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/runqueue.py

index 967e944963c604a3334b060aabe5672139c10211..7d3e91a743a2d29d6c7b2bc26e85472e01e76480 100644 (file)
@@ -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