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/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new ec074fd202 [KYUUBI #7015] Record the session disconnected info into 
kyuubi session event
ec074fd202 is described below

commit ec074fd2022ef891b59e8d79bc52879a83af4717
Author: Wang, Fei <[email protected]>
AuthorDate: Thu Apr 10 00:09:33 2025 -0700

    [KYUUBI #7015] Record the session disconnected info into kyuubi session 
event
    
    ### Why are the changes needed?
    
    Currently, if the kyuubi session between client and kyuubi session 
disconnected without closing properly, it is difficult to debug, and we have to 
check the kyuubi server log.
    
    It is better that, we can record such kind of information into kyuubi 
session event.
    ### How was this patch tested?
    
    IT.
    
    <img width="1264" alt="image" 
src="https://github.com/user-attachments/assets/d2c5b6d0-6298-46ec-9b73-ce648551120c";
 />
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #7015 from turboFei/disconnect.
    
    Closes #7015
    
    c95709284 [Wang, Fei] do not post
    e46521410 [Wang, Fei] nit
    bca7f9b7e [Wang, Fei] post
    1cf6f8f49 [Wang, Fei] disconnect
    
    Authored-by: Wang, Fei <[email protected]>
    Signed-off-by: Wang, Fei <[email protected]>
---
 .../apache/kyuubi/server/KyuubiTBinaryFrontendService.scala  | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
index 2d06bed016..26de2784c9 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/server/KyuubiTBinaryFrontendService.scala
@@ -21,7 +21,7 @@ import java.util.Base64
 
 import org.apache.hadoop.conf.Configuration
 
-import org.apache.kyuubi.KyuubiSQLException
+import org.apache.kyuubi.{KyuubiException, KyuubiSQLException}
 import org.apache.kyuubi.cli.Handle
 import org.apache.kyuubi.config.KyuubiConf
 import 
org.apache.kyuubi.config.KyuubiConf.KYUUBI_SERVER_THRIFT_RESULTSET_DEFAULT_FETCH_SIZE
@@ -69,6 +69,16 @@ final class KyuubiTBinaryFrontendService(
           serverContext: ServerContext,
           input: TProtocol,
           output: TProtocol): Unit = {
+        val handle = serverContext.getSessionHandle
+        if (handle != null) {
+          be.sessionManager
+            .getSessionOption(handle)
+            .map(_.asInstanceOf[KyuubiSessionImpl])
+            .flatMap(_.getSessionEvent).foreach { sessionEvent =>
+              sessionEvent.exception = Some(new KyuubiException(
+                s"Session between client and Kyuubi server disconnected 
without closing properly."))
+            }
+        }
         super.deleteContext(serverContext, input, output)
         MetricsSystem.tracing { ms =>
           ms.decCount(THRIFT_BINARY_CONN_OPEN)

Reply via email to