]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake: runqueue: More carefully handle the sigchld handler
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 18 Mar 2014 10:21:34 +0000 (10:21 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 18 Mar 2014 10:23:13 +0000 (10:23 +0000)
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.

(Bitbake rev: 79acfb0853aa3215215cee89a945f8e97b0a8fae)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
bitbake/lib/bb/runqueue.py

index 3c72b60f5052b11c3813cd46a2a2423ffa9e7036..e8dfb394cdca5d4694d91ef50a9e9b285e80f12d 100644 (file)
@@ -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