aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-18 10:21:34 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-03-18 10:21:37 +0000
commit79acfb0853aa3215215cee89a945f8e97b0a8fae (patch)
treecdf99e42c8f321a19f20877d09c48bfcfd6cbe28 /lib
parentcc98b19112ab875ebc7cb604cd96acadac4cbf21 (diff)
downloadbitbake-79acfb0853aa3215215cee89a945f8e97b0a8fae.tar.gz
runqueue: More carefully handle the sigchld handler
We've noticed hanging processes which appear to be looping around waitpid. Its possible multiple calls to teardown are causing problem or in theory multiple registrations (although the code should not allow that). Regardless, put better guards around signal handler registration. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/bb/runqueue.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/bb/runqueue.py b/lib/bb/runqueue.py
index 3c72b60f5..e8dfb394c 100644
--- a/lib/bb/runqueue.py
+++ b/lib/bb/runqueue.py
@@ -937,8 +937,9 @@ class RunQueue:
if self.worker:
self.teardown_workers()
self.teardown = False
- self.oldsigchld = signal.getsignal(signal.SIGCHLD)
- signal.signal(signal.SIGCHLD, self.sigchild_exception)
+ if not self.oldsigchld:
+ self.oldsigchld = signal.getsignal(signal.SIGCHLD)
+ signal.signal(signal.SIGCHLD, self.sigchild_exception)
self.worker, self.workerpipe = self._start_worker()
def start_fakeworker(self, rqexec):
@@ -949,6 +950,7 @@ class RunQueue:
self.teardown = True
if self.oldsigchld:
signal.signal(signal.SIGCHLD, self.oldsigchld)
+ self.oldsigchld = None
self._teardown_worker(self.worker, self.workerpipe)
self.worker = None
self.workerpipe = None