diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-11 18:09:37 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-12 05:58:48 -0700 |
commit | 9104a32196405a4bf5312eccdc0d4a207f8bf9f1 (patch) | |
tree | 2a9af39e8aae292d8ff6912e6e5c13ae5d5dfc99 /bitbake/lib | |
parent | 1960f6b2ecbb793b40ebc9aed25c8f9cb7884c9a (diff) | |
download | ast2050-yocto-poky-9104a32196405a4bf5312eccdc0d4a207f8bf9f1.zip ast2050-yocto-poky-9104a32196405a4bf5312eccdc0d4a207f8bf9f1.tar.gz |
bitbake: runqueue: Improve sigchld handler
The sigchld handler was reaping any processes and this was leading to
confusion with any other process handling code that could be active.
This patch:
a) Ensures we only read any process results for the worker processes
we want to monitor
b) Ensures we pass the event to any other sigchld handler if
it isn't an event we're interested in so the functions are properly
chained.
Together this should resolve some of the reports of unknown processes
people have been reporting.
(Bitbake rev: fe8baaa2f533db7a1b7203476c675588923d8d45)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index 6650bd8..a30f594 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py @@ -856,6 +856,7 @@ class RunQueue: self.workerpipe = None self.fakeworker = None self.fakeworkerpipe = None + self.oldsigchld = None def _start_worker(self, fakeroot = False, rqexec = None): logger.debug(1, "Starting bitbake-worker") @@ -912,11 +913,12 @@ class RunQueue: continue workerpipe.close() - def sigchild_exception(self, signum, stackframe): - pid = True - while pid: + def sigchild_exception(self, *args, **kwargs): + for w in [self.worker, self.fakeworker]: + if not w: + continue try: - pid, status = os.waitpid(-1, os.WNOHANG) + pid, status = os.waitpid(w.pid, os.WNOHANG) if pid != 0 and not self.teardown: if self.worker and pid == self.worker.pid: name = "Worker" @@ -928,11 +930,14 @@ class RunQueue: self.finish_runqueue(True) except OSError: pid = False + if callable(self.oldsigchld): + self.oldsigchld(*args, **kwargs) def start_worker(self): if self.worker: self.teardown_workers() self.teardown = False + self.oldsigchld = signal.getsignal(signal.SIGCHLD) signal.signal(signal.SIGCHLD, self.sigchild_exception) self.worker, self.workerpipe = self._start_worker() @@ -942,7 +947,7 @@ class RunQueue: def teardown_workers(self): self.teardown = True - signal.signal(signal.SIGCHLD, signal.SIG_DFL) + signal.signal(signal.SIGCHLD, self.oldsigchld) self._teardown_worker(self.worker, self.workerpipe) self.worker = None self.workerpipe = None |