diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/runqueue.py | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index c486c988e2..6650bd8637 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py | |||
@@ -912,10 +912,28 @@ class RunQueue: | |||
912 | continue | 912 | continue |
913 | workerpipe.close() | 913 | workerpipe.close() |
914 | 914 | ||
915 | def sigchild_exception(self, signum, stackframe): | ||
916 | pid = True | ||
917 | while pid: | ||
918 | try: | ||
919 | pid, status = os.waitpid(-1, os.WNOHANG) | ||
920 | if pid != 0 and not self.teardown: | ||
921 | if self.worker and pid == self.worker.pid: | ||
922 | name = "Worker" | ||
923 | elif self.fakeworker and pid == self.fakeworker.pid: | ||
924 | name = "Fakeroot" | ||
925 | else: | ||
926 | name = "Unknown" | ||
927 | bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, pid, str(status))) | ||
928 | self.finish_runqueue(True) | ||
929 | except OSError: | ||
930 | pid = False | ||
931 | |||
915 | def start_worker(self): | 932 | def start_worker(self): |
916 | if self.worker: | 933 | if self.worker: |
917 | self.teardown_workers() | 934 | self.teardown_workers() |
918 | self.teardown = False | 935 | self.teardown = False |
936 | signal.signal(signal.SIGCHLD, self.sigchild_exception) | ||
919 | self.worker, self.workerpipe = self._start_worker() | 937 | self.worker, self.workerpipe = self._start_worker() |
920 | 938 | ||
921 | def start_fakeworker(self, rqexec): | 939 | def start_fakeworker(self, rqexec): |
@@ -924,6 +942,7 @@ class RunQueue: | |||
924 | 942 | ||
925 | def teardown_workers(self): | 943 | def teardown_workers(self): |
926 | self.teardown = True | 944 | self.teardown = True |
945 | signal.signal(signal.SIGCHLD, signal.SIG_DFL) | ||
927 | self._teardown_worker(self.worker, self.workerpipe) | 946 | self._teardown_worker(self.worker, self.workerpipe) |
928 | self.worker = None | 947 | self.worker = None |
929 | self.workerpipe = None | 948 | self.workerpipe = None |
@@ -2090,20 +2109,6 @@ class runQueuePipe(): | |||
2090 | self.rqexec = rqexec | 2109 | self.rqexec = rqexec |
2091 | 2110 | ||
2092 | def read(self): | 2111 | def read(self): |
2093 | try: | ||
2094 | pid, status = os.waitpid(-1, os.WNOHANG) | ||
2095 | if pid != 0 and not self.rq.teardown: | ||
2096 | if self.rq.worker and pid == self.rq.worker.pid: | ||
2097 | name = "Worker" | ||
2098 | elif self.rq.fakeworker and pid == self.rq.fakeworker.pid: | ||
2099 | name = "Fakeroot" | ||
2100 | else: | ||
2101 | name = "Unknown" | ||
2102 | bb.error("%s process (%s) exited unexpectedly (%s), shutting down..." % (name, pid, str(status))) | ||
2103 | self.rq.finish_runqueue(True) | ||
2104 | except OSError: | ||
2105 | pass | ||
2106 | |||
2107 | start = len(self.queue) | 2112 | start = len(self.queue) |
2108 | try: | 2113 | try: |
2109 | self.queue = self.queue + self.input.read(102400) | 2114 | self.queue = self.queue + self.input.read(102400) |