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

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


The following commit(s) were added to refs/heads/branch-1.9 by this push:
     new 0b36409bf [KYUUBI #6353] Catch exception for closing flink internal 
session
0b36409bf is described below

commit 0b36409bfa6a54d24f0a695aecad1861f0d1de0b
Author: wforget <[email protected]>
AuthorDate: Thu Jun 6 11:41:33 2024 +0800

    [KYUUBI #6353] Catch exception for closing flink internal session
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #6353
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Catch exception for closing flink internal session.
    
    ## Types of changes :bookmark:
    
    - [X] Bugfix (non-breaking change which fixes an issue)
    - [ ] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ## Test Plan ๐Ÿงช
    
    #### Behavior Without This Pull Request :coffin:
    
    #### Behavior With This Pull Request :tada:
    
    #### Related Unit Tests
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [X] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6354 from wForget/KYUUBI-6353.
    
    Closes #6353
    
    32fc9afd9 [wforget] [KYUUBI #6353] Catch exception for closing flink 
internal session
    
    Authored-by: wforget <[email protected]>
    Signed-off-by: Cheng Pan <[email protected]>
    (cherry picked from commit a586cb4452a9bab377a4d384e374e6e9e5f289b2)
    Signed-off-by: Cheng Pan <[email protected]>
---
 .../kyuubi/engine/flink/session/FlinkSQLSessionManager.scala | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git 
a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala
 
b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala
index 73908bef8..4b049bb07 100644
--- 
a/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala
+++ 
b/externals/kyuubi-flink-sql-engine/src/main/scala/org/apache/kyuubi/engine/flink/session/FlinkSQLSessionManager.scala
@@ -81,10 +81,16 @@ class FlinkSQLSessionManager(engineContext: DefaultContext)
   }
 
   override def closeSession(sessionHandle: SessionHandle): Unit = {
-    try {
-      super.getSessionOption(sessionHandle).foreach { s =>
-        
sessionManager.closeSession(s.asInstanceOf[FlinkSessionImpl].fSession.getSessionHandle)
+    super.getSessionOption(sessionHandle).foreach { s =>
+      val internalSessionHandle = 
s.asInstanceOf[FlinkSessionImpl].fSession.getSessionHandle
+      try {
+        sessionManager.closeSession(internalSessionHandle)
+      } catch {
+        case t: Throwable =>
+          warn(s"Error closing flink internal session $internalSessionHandle", 
t)
       }
+    }
+    try {
       super.closeSession(sessionHandle)
     } catch {
       case t: Throwable =>

Reply via email to