diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-19 17:44:39 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-19 17:44:42 +0000 |
commit | 60969cd62e21e7d4af161bf8504b7643a879c73f (patch) | |
tree | b53c7e0103e97de7679a607afc340b644adc7cc0 /lib/bb/runqueue.py | |
parent | 5b9a099ec2a1dc954b614e12a306595f55b6a99e (diff) | |
download | bitbake-contrib-60969cd62e21e7d4af161bf8504b7643a879c73f.tar.gz |
runqueue: Remove use of waitpid on worker processes
Use of waitpid on the worker processes is a bad idea since it conflicts
directly with subprocess internals. Instead use the poll() method
and returncode to determine if the process has exitted, if it has,
we can shut down the system.
This should resolve the hangs once and for all, famous last words.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/runqueue.py')
-rw-r--r-- | lib/bb/runqueue.py | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py index e62bb5232..dbb334c55 100644 --- a/lib/bb/runqueue.py +++ b/lib/bb/runqueue.py @@ -2090,22 +2090,18 @@ class runQueuePipe(): self.rqexec = rqexec def read(self): - try: - for w in [self.rq.worker, self.rq.fakeworker]: - if not w: - continue - pid, status = os.waitpid(w.pid, os.WNOHANG) - if pid != 0 and not self.rq.teardown: - if self.rq.worker and pid == self.rq.worker.pid: - name = "Worker" - elif self.rq.fakeworker and pid == self.rq.fakeworker.pid: - name = "Fakeroot" - else: - name = "Unknown" - bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, pid, str(status))) - self.rq.finish_runqueue(True) - except OSError: - pass + for w in [self.rq.worker, self.rq.fakeworker]: + if not w: + continue + w.poll() + if w.returncode is not None and not self.rq.teardown: + name = None + if self.rq.worker and w.pid == self.rq.worker.pid: + name = "Worker" + elif self.rq.fakeworker and w.pid == self.rq.fakeworker.pid: + name = "Fakeroot" + bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, w.pid, str(w.returncode))) + self.rq.finish_runqueue(True) start = len(self.queue) try: |