Bläddra i källkod

AMBARI-13007: Stopping ambari-server may kill ambari-agent running on the same machine in some cases (Nahappan Somasundaram via jluniya)

Jayush Luniya 9 år sedan
förälder
incheckning
02fcea6c3c
1 ändrade filer med 7 tillägg och 0 borttagningar
  1. 7 0
      ambari-server/src/main/python/ambari_server_main.py

+ 7 - 0
ambari-server/src/main/python/ambari_server_main.py

@@ -299,6 +299,13 @@ def server_process_main(options, scmStatus=None):
 
     raise FatalException(-1, AMBARI_SERVER_DIE_MSG.format(exitcode, configDefaults.SERVER_OUT_FILE))
   else:
+    # Change the group id to the process id of the parent so that the launched
+    # process and sub-processes have a group id that is different from the parent.
+    try:
+      os.setpgid(pidJava, 0)
+    except OSError, e:
+      print_warning_msg('setpgid({0}, 0) failed - {1}'.format(pidJava, str(e)))
+      pass
     pidfile = os.path.join(configDefaults.PID_DIR, PID_NAME)
     save_pid(pidJava, pidfile)
     print "Server PID at: "+pidfile