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 ea2828070 [KYUUBI #5029] Close the alive probe session after engine
session closed
ea2828070 is described below
commit ea2828070c5d59317f76baefe560fd25eaaf2ecd
Author: fwang12 <[email protected]>
AuthorDate: Thu Jul 6 21:33:50 2023 +0800
[KYUUBI #5029] Close the alive probe session after engine session closed
### _Why are the changes needed?_
Now the server side session idle time is controlled by kyuubi admin, and
the engine session idle time is controlled by users.
If the engine session idle time is short than that of the server session.
The engine session might be closed after engine session idle time, and now
the alive probe session will still check the engine alive until the server
session idle than the server session idle timeout.

In this pr, we will close the alive probe if the engine session transport
is not open.
### _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/contributing/code/testing.html#running-tests)
locally before make a pull request
Closes #5029 from turboFei/close_alive_session.
Closes #5029
6ac3d9c1f [fwang12] close alive probe session after engine session closed
Authored-by: fwang12 <[email protected]>
Signed-off-by: fwang12 <[email protected]>
---
.../scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git
a/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
b/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
index c02851715..6cace4452 100644
---
a/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
+++
b/kyuubi-server/src/main/scala/org/apache/kyuubi/client/KyuubiSyncThriftClient.scala
@@ -59,7 +59,7 @@ class KyuubiSyncThriftClient private (
@volatile private var _aliveProbeSessionHandle: TSessionHandle = _
@volatile private var remoteEngineBroken: Boolean = false
- @volatile private var clientClosedOnEngineBroken: Boolean = false
+ @volatile private var clientClosedByAliveProbe: Boolean = false
private val engineAliveProbeClient = engineAliveProbeProtocol.map(new
TCLIService.Client(_))
private var engineAliveThreadPool: ScheduledExecutorService = _
@volatile private var engineLastAlive: Long = _
@@ -84,7 +84,7 @@ class KyuubiSyncThriftClient private (
"engine-alive-probe-" + _aliveProbeSessionHandle)
val task = new Runnable {
override def run(): Unit = {
- if (!remoteEngineBroken) {
+ if (!remoteEngineBroken && protocol.getTransport.isOpen) {
engineAliveProbeClient.foreach { client =>
val tGetInfoReq = new TGetInfoReq()
tGetInfoReq.setSessionHandle(_aliveProbeSessionHandle)
@@ -114,7 +114,7 @@ class KyuubiSyncThriftClient private (
}
}
}
- clientClosedOnEngineBroken = true
+ clientClosedByAliveProbe = true
shutdownAsyncRequestExecutor()
Option(engineAliveThreadPool).foreach { pool =>
ThreadUtils.shutdown(pool, Duration(engineAliveProbeInterval,
TimeUnit.MILLISECONDS))
@@ -206,7 +206,7 @@ class KyuubiSyncThriftClient private (
}
def closeSession(): Unit = {
- if (clientClosedOnEngineBroken) return
+ if (clientClosedByAliveProbe) return
try {
if (_remoteSessionHandle != null) {
val req = new TCloseSessionReq(_remoteSessionHandle)