Skip to content

Commit 45e5eda

Browse files
yaooqinnulysses-you
authored andcommitted
[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 0dc3aa7 [Kent Yao] [KYUUBI #2351] Fix Hive Engine terminating blocked by non-daemon threads Authored-by: Kent Yao <yao@apache.org> Signed-off-by: ulysses-you <ulyssesyou@apache.org>
1 parent 70a3005 commit 45e5eda

File tree

1 file changed

+9
-2
lines changed
  • externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive

1 file changed

+9
-2
lines changed

externals/kyuubi-hive-sql-engine/src/main/scala/org/apache/kyuubi/engine/hive/HiveSQLEngine.scala

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@ class HiveSQLEngine extends Serverable("HiveSQLEngine") {
4646
backendService.sessionManager.startTerminatingChecker(() => stop())
4747
}
4848

49-
override protected def stopServer(): Unit = {}
49+
override protected def stopServer(): Unit = {
50+
// #2351
51+
// https://issues.apache.org/jira/browse/HIVE-23164
52+
// Server is not properly terminated because of non-daemon threads
53+
System.exit(0)
54+
}
5055
}
5156

5257
object HiveSQLEngine extends Logging {
@@ -93,7 +98,9 @@ object HiveSQLEngine extends Logging {
9398
val event = HiveEngineEvent(engine)
9499
info(event)
95100
EventBus.post(event)
96-
Utils.addShutdownHook(() => engine.stop())
101+
Utils.addShutdownHook(() => {
102+
engine.getServices.foreach(_.stop())
103+
})
97104
currentEngine = Some(engine)
98105
engine
99106
}

0 commit comments

Comments
 (0)