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/12/20 12:47:32 UTC

[incubator-kyuubi] branch master updated: [KYUUBI #3615][FOLLOWUP] Client close session when retry to open failed

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 d87a6c756 [KYUUBI #3615][FOLLOWUP] Client close session when retry to open failed
d87a6c756 is described below

commit d87a6c7567721aa277f137449afbabcd2d3b3b53
Author: maming <ma...@ctrip.com>
AuthorDate: Tue Dec 20 20:47:24 2022 +0800

    [KYUUBI #3615][FOLLOWUP] Client close session when retry to open failed
    
    ### _Why are the changes needed?_
    Client will retry to open the engine when encountering a special error in [KYUUBI #3615](https://github.com/apache/incubator-kyuubi/pull/3618), but it will lead to `TProtocol` leaks when the attempt failed.
    
    ### _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
    
    - [ ] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request
    
    Closes #4017 from mattshma/close_client_when_retry_fail.
    
    Closes #3615
    
    769e4ca50 [maming] reformat code style
    6bf81dff1 [maming] optimize warn log
    088105e90 [maming] optimize code
    fc98810e3 [maming] Client close session when retry to open failed
    
    Authored-by: maming <ma...@ctrip.com>
    Signed-off-by: fwang12 <fw...@ebay.com>
---
 .../scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala   | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
index 5f6866bc8..38cdb9cc7 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala
@@ -177,6 +177,17 @@ class KyuubiSessionImpl(
             throw e
         } finally {
           attempt += 1
+          if (shouldRetry && _client != null) {
+            try {
+              _client.closeSession()
+            } catch {
+              case e: Throwable =>
+                warn(
+                  "Error on closing broken client of engine " +
+                    s"[${engine.defaultEngineName} $host:$port]",
+                  e)
+            }
+          }
         }
       }
       sessionEvent.openedTime = System.currentTimeMillis()