Repository: ambari Updated Branches: refs/heads/trunk e8f2f2fd7 -> 02fcea6c3
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/02fcea6c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/02fcea6c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/02fcea6c Branch: refs/heads/trunk Commit: 02fcea6c3c38f2fff4e73bdc3d235cf87477d4e2 Parents: e8f2f2f Author: Jayush Luniya <[email protected]> Authored: Fri Sep 11 13:08:25 2015 -0700 Committer: Jayush Luniya <[email protected]> Committed: Fri Sep 11 13:08:25 2015 -0700 ---------------------------------------------------------------------- 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/02fcea6c/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 dcca85a..0634090 100644 --- a/ambari-server/src/main/python/ambari_server_main.py +++ b/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
