The nuke_subproces function should always do a poll() on the process it's
going to try and kill, otherwise we run the risk of signalling a new
process with the same pid.
Risk: Low
Visibility: Reduces the risk of bad SIGTERMs.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2166 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index a1a2ef0..b67810c 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -398,6 +398,10 @@
def nuke_subprocess(subproc):
+ # check if the subprocess is still alive, first
+ if subproc.poll() is not None:
+ return subproc.poll()
+
# the process has not terminated within timeout,
# kill it via an escalating series of signals.
signal_queue = [signal.SIGTERM, signal.SIGKILL]