summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-18 22:58:52 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-18 23:05:53 +0000
commit0150bc30d3674301631c2e9b6c64e01058fd1070 (patch)
tree40caf426b8e02aac158cd1c93e85a7c1b091cacd /bitbake/lib
parentcfd1c4e79eb4e41e2090411adb8f7be2fbcc8e97 (diff)
downloadast2050-yocto-poky-0150bc30d3674301631c2e9b6c64e01058fd1070.zip
ast2050-yocto-poky-0150bc30d3674301631c2e9b6c64e01058fd1070.tar.gz
bitbake: runqueue: Really fix sigchld handling
There are several problems. Firstly, a return value of "None" can mean there is a C signal handler installed so we need to better handle that case. signal.SIG_DFL is 0 which equates to false so we also need to handle that by testing explicitly for None. Finally, the signal handler *must* call waitpid on all child processes else it will just get called repeatedly, leading to the hanging behaviour we've been seeing. The solution is to only error for the worker children, we warn about any other stray children which we'll have to figure out the sources of in due course. Hopefully this patch gets things working again properly though. (Bitbake rev: 973876c706f08735c1b68c791a5a137e5f083dd2) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/runqueue.py28
1 files changed, 14 insertions, 14 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index b71e1d0..fa7a99f 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -914,32 +914,32 @@ class RunQueue:
workerpipe.close()
def sigchild_exception(self, *args, **kwargs):
- for w in [self.worker, self.fakeworker]:
- if not w:
- continue
+ pid = -1
+ while pid:
try:
- pid, status = os.waitpid(w.pid, os.WNOHANG)
+ pid, status = os.waitpid(-1, os.WNOHANG)
if pid != 0 and not self.teardown:
+ name = None
if self.worker and pid == self.worker.pid:
name = "Worker"
elif self.fakeworker and pid == self.fakeworker.pid:
name = "Fakeroot"
else:
- name = "Unknown"
- bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, pid, str(status)))
- self.finish_runqueue(True)
+ bb.warn("Unknown process (%s) exited unexpectedly (%s), shutting down..." % (pid, str(status)))
+ if name and not self.teardown:
+ bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, pid, str(status)))
+ self.finish_runqueue(True)
except OSError:
- pid = False
- if callable(self.oldsigchld) and self.oldsigchld != self.sigchild_exception:
- self.oldsigchld(*args, **kwargs)
+ return
def start_worker(self):
if self.worker:
self.teardown_workers()
self.teardown = False
- if not self.oldsigchld:
- self.oldsigchld = signal.getsignal(signal.SIGCHLD)
- signal.signal(signal.SIGCHLD, self.sigchild_exception)
+ if self.oldsigchld is None:
+ self.oldsigchld = signal.signal(signal.SIGCHLD, self.sigchild_exception)
+ if self.oldsigchld is None:
+ self.oldsigchld = signal.SIG_DFL
self.worker, self.workerpipe = self._start_worker()
def start_fakeworker(self, rqexec):
@@ -948,7 +948,7 @@ class RunQueue:
def teardown_workers(self):
self.teardown = True
- if self.oldsigchld:
+ if self.oldsigchld is not None:
signal.signal(signal.SIGCHLD, self.oldsigchld)
self.oldsigchld = None
self._teardown_worker(self.worker, self.workerpipe)
OpenPOWER on IntegriCloud