While working on graceful kill I noticed that when we call interrupt on a command then the forked child is left orphaned and the pid_exists() check always return true and graceful kill timeouts.
Adding join() call after sending the interrupt solves this problem.
Signed-off-by: Jan Tluka jtluka@redhat.com --- lnst/Common/NetTestCommand.py | 1 + 1 file changed, 1 insertion(+)
diff --git a/lnst/Common/NetTestCommand.py b/lnst/Common/NetTestCommand.py index f09e402..6573ffd 100644 --- a/lnst/Common/NetTestCommand.py +++ b/lnst/Common/NetTestCommand.py @@ -212,6 +212,7 @@ class NetTestCommand: else: logging.debug("Interrupting command with id "%s", pid "%d"" % (self._id, self._pid)) os.killpg(os.getpgid(self._pid), signal.SIGINT) + self._process.join() self._control_cmd = cmd
def kill(self, cmd):