Patchwork [bitbake-devel,1/2] runqueue: wait and deal with those <defunct> sub-processes as soon as they are os.killed() when "Force stop"

login
register
mail settings
Submitter Shane Wang
Date March 30, 2012, 9:12 a.m.
Message ID <7bb76a68926bc36bc6f8a27180916e13c5c304a3.1333098599.git.shane.wang@intel.com>
Download mbox | patch
Permalink /patch/24915/
State New
Headers show

Comments

Shane Wang - March 30, 2012, 9:12 a.m.
When "Force stop" is performed during the build stage, after os.kill() kills the build sub-processes, there are many <defunct> python processes in the system. In Hob, when the user initiates a new build, os.waitpid() in runqueue_process_waitpid() will be called, and the pids of those <defunct> processes will be returned as result[0], then self.build_pids[result[0]] will throw KeyError exception because now for the new build self.build_pids is empty.

This patch is to address the above issue to collect the results and handle the sub-processes as soon as they are killed.

[Yocto #2186]

Signed-off-by: Shane Wang <shane.wang@intel.com>
---
 bitbake/lib/bb/runqueue.py |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 6970548..b870caf 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -1068,6 +1068,7 @@  class RunQueueExecute:
             for k, v in self.build_pids.iteritems():
                 try:
                     os.kill(-k, signal.SIGTERM)
+                    os.waitpid(-1, 0)
                 except:
                     pass
         for pipe in self.build_pipes: