If any of the autotestd_monitor child processes die, the monitor
itself should also die, or else the server may never notice it has
stopped sending it client output and will sit around waiting for the
client to finish forever. If one of the tail processes dies the
monitor is effecively dead, so it should just terminate itself and
give the server a chance to restart it.
Risk: Low
Visibility: Fixes a potential server <-> client deadlock.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2960 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/bin/autotestd_monitor b/client/bin/autotestd_monitor
index 029dbc8..f681863 100755
--- a/client/bin/autotestd_monitor
+++ b/client/bin/autotestd_monitor
@@ -7,6 +7,11 @@
stdout_start = int(sys.argv[2]) # number of bytes we can skip on stdout
stderr_start = int(sys.argv[3]) # nubmer of bytes we can skip on stderr
+# if any of our tail processes die, the monitor should die too
+def kill_self(signum, frame):
+ os.kill(os.getpid(), signal.SIGTERM)
+signal.signal(signal.SIGCHLD, kill_self)
+
devnull = open(os.devnull, 'w')
# launch some tail processes to pump the std* streams