You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by ul...@apache.org on 2022/04/20 01:39:03 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2351] Fix Hive Engine terminating blocked by non-daemon threads

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 45e5eda0b [KYUUBI #2351] Fix Hive Engine terminating blocked by non-daemon threads
45e5eda0b is described below

commit 45e5eda0bd714b22f78d82b5fa8e41f50a072d4e
Author: Kent Yao <ya...@apache.org>
AuthorDate: Wed Apr 20 09:38:55 2022 +0800

    [KYUUBI #2351] Fix Hive Engine terminating blocked by non-daemon threads
    
    ### _Why are the changes needed?_
    
    close #2351
    
    ### _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 #2412 from yaooqinn/2351.
    
    Closes #2351
    
    0dc3aa7b [Kent Yao] [KYUUBI #2351] Fix Hive Engine terminating blocked by non-daemon threads
    
    Authored-by: Kent Yao <ya...@apache.org>
    Signed-off-by: ulysses-you <ul...@apache.org>
---
 .../scala/org/apache/kyuubi/engine/hive/HiveSQLEngine.scala   | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/HiveSQLEngine.scala b/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/HiveSQLEngine.scala
index f9cf00cb2..2e77bdd9f 100644
--- a/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/HiveSQLEngine.scala
+++ b/externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/HiveSQLEngine.scala
@@ -46,7 +46,12 @@ class HiveSQLEngine extends Serverable("HiveSQLEngine") {
     backendService.sessionManager.startTerminatingChecker(() => stop())
   }
 
-  override protected def stopServer(): Unit = {}
+  override protected def stopServer(): Unit = {
+    // #2351
+    // https://issues.apache.org/jira/browse/HIVE-23164
+    // Server is not properly terminated because of non-daemon threads
+    System.exit(0)
+  }
 }
 
 object HiveSQLEngine extends Logging {
@@ -93,7 +98,9 @@ object HiveSQLEngine extends Logging {
     val event = HiveEngineEvent(engine)
     info(event)
     EventBus.post(event)
-    Utils.addShutdownHook(() => engine.stop())
+    Utils.addShutdownHook(() => {
+      engine.getServices.foreach(_.stop())
+    })
     currentEngine = Some(engine)
     engine
   }