This is an automated email from the ASF dual-hosted git repository. chengpan 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 9a50bfa814 [KYUUBI #7158] Spark engine respects session-level idle timeout threshold 9a50bfa814 is described below commit 9a50bfa814d27541171c4dc302c0bb43c1aa8322 Author: liangzhaoyuan <lwlzyl19940...@gmail.com> AuthorDate: Mon Aug 4 11:28:10 2025 +0800 [KYUUBI #7158] Spark engine respects session-level idle timeout threshold ### Why are the changes needed? Fixes the same class of issue as https://github.com/apache/kyuubi/pull/7138 Previously, `sessionIdleTimeoutThreshold` was initialized only once during session creation using `sessionManager.getConf`, preventing dynamic updates when clients pass new configurations during connection. we now: - Allow clients to set session-specific kyuubi.session.idle.timeout` during connection - Dynamically adjust idle timeout per session - Prevent connection pile-up by timely recycling idle sessions Closes #7158 from 1358035421/lc/sessio_idle_timeout_threshold. Closes #7158 abe513eed [liangzhaoyuan] fix review comments 3face844a [liangzhaoyuan] Use per-session idle timeout threshold instead of global sessionManager's value Authored-by: liangzhaoyuan <lwlzyl19940...@gmail.com> Signed-off-by: Cheng Pan <cheng...@apache.org> --- .../org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala index 85c918eb66..9498483be6 100644 --- a/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala +++ b/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSessionImpl.scala @@ -24,6 +24,7 @@ import org.apache.spark.sql.{AnalysisException, SparkSession} import org.apache.spark.ui.SparkUIUtils.formatDuration import org.apache.kyuubi.KyuubiSQLException +import org.apache.kyuubi.config.KyuubiConf.SESSION_IDLE_TIMEOUT import org.apache.kyuubi.config.KyuubiReservedKeys.KYUUBI_SESSION_HANDLE_KEY import org.apache.kyuubi.engine.spark.events.SessionEvent import org.apache.kyuubi.engine.spark.operation.SparkSQLOperationManager @@ -57,6 +58,13 @@ class SparkSessionImpl( } } + override val sessionIdleTimeoutThreshold: Long = { + conf.get(SESSION_IDLE_TIMEOUT.key) + .map(_.toLong) + .getOrElse( + sessionManager.getConf.get(SESSION_IDLE_TIMEOUT)) + } + private val sessionEvent = SessionEvent(this) override def open(): Unit = {