You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by GitBox <gi...@apache.org> on 2022/12/12 02:41:17 UTC

[GitHub] [incubator-kyuubi] ulysses-you commented on a diff in pull request #3923: Add dedicated batch session idle timeout and prevent the batch submission operation timeout

ulysses-you commented on code in PR #3923:
URL: https://github.com/apache/incubator-kyuubi/pull/3923#discussion_r1045361627


##########
kyuubi-common/src/main/scala/org/apache/kyuubi/session/SessionManager.scala:
##########
@@ -288,6 +288,19 @@ abstract class SessionManager(name: String) extends CompositeService(name) {
     ThreadUtils.shutdown(execPool, Duration(shutdownTimeout, TimeUnit.MILLISECONDS))
   }
 
+  protected def checkSessionTimeout(current: Long, session: Session, timeout: Long): Unit = {
+    if (session.lastAccessTime + timeout <= current && session.getNoOperationTime > timeout) {
+      try {
+        closeSession(session.handle)
+      } catch {
+        case e: KyuubiSQLException =>
+          warn(s"Error closing idle session ${session.handle}", e)
+      }
+    } else {
+      session.closeExpiredOperations()
+    }
+  }
+
   private def startTimeoutChecker(): Unit = {
     val interval = conf.get(SESSION_CHECK_INTERVAL)
     val timeout = conf.get(SESSION_IDLE_TIMEOUT)

Review Comment:
   How about add a new filed `sessionTimeout` in `Session`. Use  `SESSION_IDLE_TIMEOUT ` by default in `AbstractSession`, and use `BATCH_SESSION_IDLE_TIMEOUT` in `KyuubiBatchSessionImpl`.
   
   Then we can make each session use it's own timeout threshold.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org