You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kyuubi.apache.org by fe...@apache.org on 2022/06/10 15:24:07 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #2849] Close the engine alive pool gracefully

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

feiwang 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 ce56d7007 [KYUUBI #2849] Close the engine alive pool gracefully
ce56d7007 is described below

commit ce56d700707434e6c3ee22952ab86121897e1d78
Author: Fei Wang <fw...@ebay.com>
AuthorDate: Fri Jun 10 23:24:00 2022 +0800

    [KYUUBI #2849] Close the engine alive pool gracefully
    
    ### _Why are the changes needed?_
    
    Close the engine alive thread pool and wait the in flight task finished.
    And try to close the engine alive probe client anyway.
    
    ### _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 #2849 from turboFei/live_probe_close.
    
    Closes #2849
    
    1c0af3dd8 [Fei Wang] remove tag
    a7ac501b3 [Fei Wang] add tag
    acc36ec33 [Fei Wang] Close aliveness probe client
    012bf95e2 [Fei Wang] wait the eninge alive task stop
    
    Authored-by: Fei Wang <fw...@ebay.com>
    Signed-off-by: Fei Wang <fw...@ebay.com>
---
 .../scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala    | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
index b5157f739..9e63c7f6c 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
@@ -21,6 +21,7 @@ import java.util.concurrent.{ScheduledExecutorService, TimeUnit}
 import java.util.concurrent.locks.ReentrantLock
 
 import scala.collection.JavaConverters._
+import scala.concurrent.duration.Duration
 
 import org.apache.hive.service.rpc.thrift._
 import org.apache.thrift.TException
@@ -163,8 +164,10 @@ class KyuubiSyncThriftClient private (
       case e: Exception =>
         throw KyuubiSQLException("Error while cleaning up the engine resources", e)
     } finally {
-      Option(engineAliveThreadPool).foreach(_.shutdown())
-      if (_aliveProbeSessionHandle != null && !remoteEngineBroken) {
+      Option(engineAliveThreadPool).foreach { pool =>
+        ThreadUtils.shutdown(pool, Duration(engineAliveProbeInterval, TimeUnit.MILLISECONDS))
+      }
+      if (_aliveProbeSessionHandle != null) {
         engineAliveProbeClient.foreach { client =>
           Utils.tryLogNonFatalError {
             val req = new TCloseSessionReq(_aliveProbeSessionHandle)