Repository: ambari Updated Branches: refs/heads/branch-2.1 e7eb7006a -> 100488455
AMBARI-13007: Stopping ambari-server may kill ambari-agent running on the same machine in some cases (Nahappan Somasundaram via jluniya) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/10048845 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/10048845 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/10048845 Branch: refs/heads/branch-2.1 Commit: 1004884559a3143d4ec34a3e4709a6298010f4fd Parents: e7eb700 Author: Jayush Luniya <[email protected]> Authored: Fri Sep 11 13:08:25 2015 -0700 Committer: Sumit Mohanty <[email protected]> Committed: Thu Nov 26 15:00:55 2015 -0800 ---------------------------------------------------------------------- ambari-server/src/main/python/ambari_server_main.py | 7 +++++++ 1 file changed, 7 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/10048845/ambari-server/src/main/python/ambari_server_main.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/python/ambari_server_main.py b/ambari-server/src/main/python/ambari_server_main.py index fba9948..76e86ee 100644 --- a/ambari-server/src/main/python/ambari_server_main.py +++ b/ambari-server/src/main/python/ambari_server_main.py @@ -283,6 +283,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
