Bladeren bron

AMBARI-2325. Agent remains in Queued status and then times out. (smohanty)

git-svn-id: https://svn.apache.org/repos/asf/incubator/ambari/trunk@1490816 13f79535-47bb-0310-9956-ffa450edef68
Sumit Mohanty 12 jaren geleden
bovenliggende
commit
5bded734a3

+ 1 - 1
ambari-agent/src/main/python/ambari_agent/PuppetExecutor.py

@@ -170,7 +170,7 @@ class PuppetExecutor:
     puppetEnv = self.configureEnviron(puppetEnv)
     logger.debug("Setting RUBYLIB as: " + rubyLib)
     logger.info("Running command " + pprint.pformat(puppetcommand))
-    puppet = self.lauch_puppet_subprocess(puppetcommand,tmpout, tmperr, puppetEnv)
+    puppet = self.lauch_puppet_subprocess(puppetcommand, tmpout, tmperr, puppetEnv)
     logger.debug("Launching watchdog thread")
     self.event.clear()
     self.last_puppet_has_been_killed = False

+ 11 - 7
ambari-agent/src/main/python/ambari_agent/shell.py

@@ -61,13 +61,17 @@ def killstaleprocesses():
 def killprocessgrp(pid):
   try:
     os.killpg(pid, signal.SIGTERM)
-    time.sleep(5)
-    try:
-      os.killpg(pid, signal.SIGKILL)
-    except:
-      logger.warn("Failed to send SIGKILL to PID %d. Process exited?" % (pid))
-  except:
-    logger.warn("Failed to kill PID %d" % (pid))      
+  except Exception, e:
+    logger.warn("Failed to kill PID %d" % (pid))
+    logger.warn("Reported error: " + repr(e))
+
+  time.sleep(5)
+
+  try:
+    os.killpg(pid, signal.SIGKILL)
+  except Exception, e:
+    logger.error("Failed to send SIGKILL to PID %d. Process exited?" % (pid))
+    logger.error("Reported error: " + repr(e))
 
 def changeUid():
   try: