Return-Path: X-Original-To: apmail-tajo-commits-archive@minotaur.apache.org Delivered-To: apmail-tajo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CE73B17850 for ; Wed, 9 Sep 2015 03:37:01 +0000 (UTC) Received: (qmail 33924 invoked by uid 500); 9 Sep 2015 03:37:01 -0000 Delivered-To: apmail-tajo-commits-archive@tajo.apache.org Received: (qmail 33890 invoked by uid 500); 9 Sep 2015 03:37:01 -0000 Mailing-List: contact commits-help@tajo.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@tajo.apache.org Delivered-To: mailing list commits@tajo.apache.org Received: (qmail 33881 invoked by uid 99); 9 Sep 2015 03:37:01 -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; Wed, 09 Sep 2015 03:37:01 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7C49BDFF72; Wed, 9 Sep 2015 03:37:01 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jhkim@apache.org To: commits@tajo.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: tajo git commit: TAJO-1828: tajo-daemon scripts should kill process after process can not stop gracefully. Date: Wed, 9 Sep 2015 03:37:01 +0000 (UTC) Repository: tajo Updated Branches: refs/heads/master bdd8e7685 -> c66d0b470 TAJO-1828: tajo-daemon scripts should kill process after process can not stop gracefully. Closes #746 Project: http://git-wip-us.apache.org/repos/asf/tajo/repo Commit: http://git-wip-us.apache.org/repos/asf/tajo/commit/c66d0b47 Tree: http://git-wip-us.apache.org/repos/asf/tajo/tree/c66d0b47 Diff: http://git-wip-us.apache.org/repos/asf/tajo/diff/c66d0b47 Branch: refs/heads/master Commit: c66d0b4708814ed8f7a1ae530338e1fcf87caddc Parents: bdd8e76 Author: Jinho Kim Authored: Wed Sep 9 12:35:02 2015 +0900 Committer: Jinho Kim Committed: Wed Sep 9 12:36:36 2015 +0900 ---------------------------------------------------------------------- CHANGES | 3 +++ tajo-dist/src/main/bin/tajo-daemon.sh | 12 ++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/tajo/blob/c66d0b47/CHANGES ---------------------------------------------------------------------- diff --git a/CHANGES b/CHANGES index 52d1ca5..a704b86 100644 --- a/CHANGES +++ b/CHANGES @@ -36,6 +36,9 @@ Release 0.11.0 - unreleased IMPROVEMENT + TAJO-1828: tajo-daemon scripts should kill process after process can not + stop gracefully. (jinho) + TAJO-1729: No handling of default case in DDLExecutor. (Contributed by Dongkyu Hwangbo. Committed by jinho) http://git-wip-us.apache.org/repos/asf/tajo/blob/c66d0b47/tajo-dist/src/main/bin/tajo-daemon.sh ---------------------------------------------------------------------- diff --git a/tajo-dist/src/main/bin/tajo-daemon.sh b/tajo-dist/src/main/bin/tajo-daemon.sh index 48790e9..6343df7 100755 --- a/tajo-dist/src/main/bin/tajo-daemon.sh +++ b/tajo-dist/src/main/bin/tajo-daemon.sh @@ -95,6 +95,7 @@ fi export TAJO_LOGFILE=tajo-$TAJO_IDENT_STRING-$command-$HOSTNAME.log export TAJO_ROOT_LOGGER_APPENDER="${TAJO_ROOT_LOGGER_APPENDER:-DRFA}" export TAJO_PULLSERVER_STANDALONE="${TAJO_PULLSERVER_STANDALONE:-false}" +export TAJO_STOP_TIMEOUT=${TAJO_STOP_TIMEOUT:-2} log=$TAJO_LOG_DIR/tajo-$TAJO_IDENT_STRING-$command-$HOSTNAME.out pid=$TAJO_PID_DIR/tajo-$TAJO_IDENT_STRING-$command.pid @@ -132,12 +133,19 @@ case $startStop in (stop) if [ -f $pid ]; then - if kill -0 `cat $pid` > /dev/null 2>&1; then + TARGET_PID=`cat $pid` + if kill -0 $TARGET_PID > /dev/null 2>&1; then echo stopping $command - kill `cat $pid` + kill $TARGET_PID + sleep $TAJO_STOP_TIMEOUT + if kill -0 $TARGET_PID > /dev/null 2>&1; then + echo "$command did not stop gracefully after $TAJO_STOP_TIMEOUT seconds: killing with kill -9" + kill -9 $TARGET_PID + fi else echo no $command to stop fi + rm -f $pid else echo no $command to stop fi