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]
(Bitbake rev:
e9f4ca467e795bbc520d12b0e7a5985b6ff0a20e)
Signed-off-by: Shane Wang <shane.wang@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
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: