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

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


The following commit(s) were added to refs/heads/branch-1.8 by this push:
     new 59119d866 [KYUUBI #4847][FOLLOWUP] Check engine alive for 
KyuubiSessionImpl only
59119d866 is described below

commit 59119d86680204016d9c49362216f1aa508a76b3
Author: fwang12 <[email protected]>
AuthorDate: Fri Nov 24 12:19:30 2023 +0800

    [KYUUBI #4847][FOLLOWUP] Check engine alive for KyuubiSessionImpl only
    
    # :mag: Description
    #4847 followup
    
    ```
    2023-11-23 20:26:48.896 ERROR org.apache.kyuubi.util.ThreadUtils: Uncaught 
exception in thread KyuubiSessionManager-engine-alive-checker: Thread-77
    java.lang.ClassCastException: class 
org.apache.kyuubi.session.KyuubiBatchSession cannot be cast to class 
org.apache.kyuubi.session.KyuubiSessionImpl 
(org.apache.kyuubi.session.KyuubiBatchSession and 
org.apache.kyuubi.session.KyuubiSessionImpl are in unnamed module of loader 
'app')
            at 
org.apache.kyuubi.session.KyuubiSessionManager.$anonfun$startEngineAliveChecker$2(KyuubiSessionManager.scala:507)
 ~[kyuubi-server_2.12-1.8.0.0.2.0.jar:1.8.0.0.2.0]
            at 
org.apache.kyuubi.session.KyuubiSessionManager.$anonfun$startEngineAliveChecker$2$adapted(KyuubiSessionManager.scala:506)
 ~[kyuubi-server_2.12-1.8.0.0.2.0.jar:1.8.0.0.2.0]
            at scala.collection.Iterator.foreach(Iterator.scala:943) 
~[scala-library-2.12.18.jar:?]
            at scala.collection.Iterator.foreach$(Iterator.scala:943) 
~[scala-library-2.12.18.jar:?]
            at scala.collection.AbstractIterator.foreach(Iterator.scala:1431) 
~[scala-library-2.12.18.jar:?]
            at scala.collection.IterableLike.foreach(IterableLike.scala:74) 
~[scala-library-2.12.18.jar:?]
            at scala.collection.IterableLike.foreach$(IterableLike.scala:73) 
~[scala-library-2.12.18.jar:?]
            at scala.collection.AbstractIterable.foreach(Iterable.scala:56) 
~[scala-library-2.12.18.jar:?]
            at 
org.apache.kyuubi.session.KyuubiSessionManager.$anonfun$startEngineAliveChecker$1(KyuubiSessionManager.scala:506)
 ~[kyuubi-server_2.12-1.8.0.0.2.0.jar:1.8.0.0.2.0]
            at 
org.apache.kyuubi.util.ThreadUtils$.$anonfun$scheduleTolerableRunnableWithFixedDelay$1(ThreadUtils.scala:126)
 ~[kyuubi-common_2.12-1.8.0.0.2.0.jar:1.8.0.0.2.0]
            at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) [?:?]
            at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305) 
[?:?]
            at 
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
 [?:?]
            at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) 
[?:?]
            at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) 
[?:?]
            at java.lang.Thread.run(Thread.java:833) [?:?]
    ```
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #
    
    ## Describe Your Solution ๐Ÿ”ง
    
    Please include a summary of the change and which issue is fixed. Please 
also include relevant motivation and context. List any dependencies that are 
required for this change.
    
    ## Types of changes :bookmark:
    
    - [ ] 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
    
    ---
    
    # Checklists
    ## ๐Ÿ“ Author Self Checklist
    
    - [ ] My code follows the [style 
guidelines](https://kyuubi.readthedocs.io/en/master/contributing/code/style.html)
 of this project
    - [ ] I have performed a self-review
    - [ ] I have commented my code, particularly in hard-to-understand areas
    - [ ] I have made corresponding changes to the documentation
    - [ ] My changes generate no new warnings
    - [ ] I have added tests that prove my fix is effective or that my feature 
works
    - [ ] New and existing unit tests pass locally with my changes
    - [ ] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    ## ๐Ÿ“ Committer Pre-Merge Checklist
    
    - [ ] Pull request title is okay.
    - [ ] No license issues.
    - [ ] Milestone correctly set?
    - [ ] Test coverage is ok
    - [ ] Assignees are selected.
    - [ ] Minimum number of approvals
    - [ ] No changes are requested
    
    **Be nice. Be informative.**
    
    Closes #5764 from turboFei/batch_session_cast_2.
    
    Closes #4847
    
    3b57a1643 [fwang12] fix
    
    Authored-by: fwang12 <[email protected]>
    Signed-off-by: fwang12 <[email protected]>
    (cherry picked from commit b70b5104b9d0b1a3566c0280d450acce98ccbb71)
    Signed-off-by: fwang12 <[email protected]>
---
 .../apache/kyuubi/session/KyuubiSessionManager.scala    | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
index c57cfbf7f..271bd7b11 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala
@@ -397,17 +397,18 @@ class KyuubiSessionManager private (name: String) extends 
SessionManager(name) {
   private def startEngineAliveChecker(): Unit = {
     val interval = conf.get(KyuubiConf.ENGINE_ALIVE_PROBE_INTERVAL)
     val checkTask: Runnable = () => {
-      allSessions().foreach { session =>
-        if 
(!session.asInstanceOf[KyuubiSessionImpl].checkEngineConnectionAlive()) {
+      allSessions().foreach {
+        case session: KyuubiSessionImpl =>
           try {
-            closeSession(session.handle)
-            logger.info(s"The session ${session.handle} has been closed " +
-              s"due to engine unresponsiveness (checked by the engine alive 
checker).")
+            if (!session.checkEngineConnectionAlive()) {
+              closeSession(session.handle)
+              logger.info(s"The session ${session.handle} has been closed " +
+                s"due to engine unresponsiveness (checked by the engine alive 
checker).")
+            }
           } catch {
-            case e: KyuubiSQLException =>
-              warn(s"Error closing session ${session.handle}", e)
+            case e: Throwable => warn(s"Error closing session 
${session.handle}", e)
           }
-        }
+        case _ =>
       }
     }
     scheduleTolerableRunnableWithFixedDelay(

Reply via email to