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 2023/02/21 02:18:11 UTC

[kyuubi] branch branch-1.7 updated: [KYUUBI #4267] Show warning if SessionHandle is invalid

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

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


The following commit(s) were added to refs/heads/branch-1.7 by this push:
     new 50330c250 [KYUUBI #4267] Show warning if SessionHandle is invalid
50330c250 is described below

commit 50330c2502a2ebf83f38eb222d0bccb41f991b30
Author: Hanna Liashchuk <g....@temabit.com>
AuthorDate: Tue Feb 21 10:17:34 2023 +0800

    [KYUUBI #4267] Show warning if SessionHandle is invalid
    
    ### _Why are the changes needed?_
    If SessionManager tries to close a session, that was previously closed - it throws an error `org.apache.kyuubi.KyuubiSQLException: Invalid SessionHandle` which causes spark session exit with non-zero code.
    
    ### _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.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4386 from hanna-liashchuk/catch-invalid-sessionhandle.
    
    Closes #4267
    
    bf364bad [Hanna Liashchuk] Show warning if SessionHandle is invalid
    
    Authored-by: Hanna Liashchuk <g....@temabit.com>
    Signed-off-by: Cheng Pan <ch...@apache.org>
    (cherry picked from commit 89cc8c1679590cc7032a4056004424fe5ed721f9)
    Signed-off-by: Cheng Pan <ch...@apache.org>
---
 .../kyuubi/engine/spark/session/SparkSQLSessionManager.scala       | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala
index 76c6a6505..cb8702df3 100644
--- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala
+++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala
@@ -164,7 +164,12 @@ class SparkSQLSessionManager private (name: String, spark: SparkSession)
         }
       }
     }
-    super.closeSession(sessionHandle)
+    try {
+      super.closeSession(sessionHandle)
+    } catch {
+      case e: KyuubiSQLException =>
+        warn(s"Error closing session ${sessionHandle}", e)
+    }
     if (shareLevel == ShareLevel.CONNECTION) {
       info("Session stopped due to shared level is Connection.")
       stopSession()