You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ch...@apache.org on 2022/09/26 07:55:58 UTC

[incubator-kyuubi] branch branch-1.6 updated: [KYUUBI #3544] Fix bin/kyuubi stop check

This is an automated email from the ASF dual-hosted git repository.

chengpan pushed a commit to branch branch-1.6
in repository https://gitbox.apache.org/repos/asf/incubator-kyuubi.git


The following commit(s) were added to refs/heads/branch-1.6 by this push:
     new 2a9761694 [KYUUBI #3544] Fix bin/kyuubi stop check
2a9761694 is described below

commit 2a9761694ec81ee9fe67689822e9334b332ff7f0
Author: asagjj <77...@qq.com>
AuthorDate: Mon Sep 26 15:55:29 2022 +0800

    [KYUUBI #3544] Fix bin/kyuubi stop check
    
    1、Check and wait until process disappeared before remove pid file.
    2、If pid file was still not be removed,we should remind user to kill and remove manually .
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #3546 from asagjj/pr-3544.
    
    Closes #3544
    
    e72e42fd [asagjj] Update bin/kyuubi
    3c789be8 [asagjj] fix bin/kyuubi stop
    
    Lead-authored-by: asagjj <77...@qq.com>
    Co-authored-by: asagjj <sh...@cmss.chinamobile.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
    (cherry picked from commit bcc167955140ac0e6457011f7f379b8566f4bc08)
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 bin/kyuubi | 23 ++++++++++++++++++++---
 1 file changed, 20 insertions(+), 3 deletions(-)

diff --git a/bin/kyuubi b/bin/kyuubi
index 082129e7a..f40f2828e 100755
--- a/bin/kyuubi
+++ b/bin/kyuubi
@@ -154,17 +154,34 @@ function stop_kyuubi() {
     TARGET_ID="$(cat "$pid")"
     if [[ $(ps -p "$TARGET_ID" -o comm=) =~ "java" ]]; then
       echo "Stopping $CLASS"
-      kill "$TARGET_ID" && rm -f "$pid"
+      kill "$TARGET_ID"
       for i in {1..20}
       do
         sleep 0.5
         if [[ ! $(ps -p "$TARGET_ID" -o comm=) =~ "java" ]]; then
+          rm -f "$pid"
           break
         fi
       done
 
-      if [[ $(ps -p "$TARGET_ID" -o comm=) =~ "java" ]]; then
-        echo "Failed to stop kyuubi after 10 seconds, try 'kill -9 ${TARGET_ID}' forcefully "
+      if [ -f ${pid} ]; then
+        echo "Failed to stop kyuubi after 10 seconds, try 'kill -9 ${TARGET_ID}' forcefully"
+        kill -9 ${TARGET_ID}
+        for i in {1..20}
+        do
+          sleep 0.5
+          if [[ ! $(ps -p "$TARGET_ID" -o comm=) =~ "java" ]]; then
+            rm -f "$pid"
+            break
+          fi
+        done
+        if [ -f ${pid} ]; then
+          echo "Failed to stop kyuubi forcefully after 10 seconds"
+          exit 1
+        else
+          kyuubi_logo
+          echo "Bye!"
+        fi
       else
         kyuubi_logo
         echo "Bye!"