Add a 10 second timeout to the conmux-attach call,
if we cannot connect in that amount of time something is wrong.
Last week the conmux was in a specific state where it was
accepting connections then not handling them at all. As a result
conmux-attach hung for almost two hours in some jobs.

Signed-off-by: Scott Zawalski <scottz@google.com>


git-svn-id: http://test.kernel.org/svn/autotest/trunk@2980 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/serial.py b/server/hosts/serial.py
index b3b8c16..24c0413 100644
--- a/server/hosts/serial.py
+++ b/server/hosts/serial.py
@@ -1,4 +1,4 @@
-import os, sys, subprocess
+import os, sys, subprocess, logging
 
 from autotest_lib.client.common_lib import utils, error
 from autotest_lib.server import utils as server_utils
@@ -56,8 +56,13 @@
         conmux_attach = cls._get_conmux_attach(conmux_attach)
         conmux_hostname = cls._get_conmux_hostname(hostname, conmux_server)
         cmd = "%s %s echo 2> /dev/null" % (conmux_attach, conmux_hostname)
-        result = utils.run(cmd, ignore_status=True)
-        return result.exit_status == 0
+        try:
+            result = utils.run(cmd, ignore_status=True, timeout=10)
+            return result.exit_status == 0
+        except error.CmdError:
+            logging.warning("Timed out while trying to attach to conmux")
+
+        return False
 
 
     def start_loggers(self):