Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 988621752E for ; Fri, 11 Sep 2015 20:08:31 +0000 (UTC) Received: (qmail 62446 invoked by uid 500); 11 Sep 2015 20:08:31 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 62413 invoked by uid 500); 11 Sep 2015 20:08:31 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 62404 invoked by uid 99); 11 Sep 2015 20:08:31 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Sep 2015 20:08:31 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 5F43DE00DC; Fri, 11 Sep 2015 20:08:31 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jluniya@apache.org To: commits@ambari.apache.org Message-Id: <3322f033bf994c99a53272c167268a62@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-13007: Stopping ambari-server may kill ambari-agent running on the same machine in some cases (Nahappan Somasundaram via jluniya) Date: Fri, 11 Sep 2015 20:08:31 +0000 (UTC) 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 Authored: Fri Sep 11 13:08:25 2015 -0700 Committer: Jayush Luniya 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