wangzhigang1999 opened a new issue, #7844:
URL: https://github.com/apache/kyuubi/issues/7844

   ### Describe the bug
   
   With `kyuubi.engine.share.level=SERVER_LOCAL`, the Spark SQL engine fails to 
open a session with a `scala.MatchError`, before executing SQL.
   
   We reproduced this through both Binary TLS JDBC and HTTP TLS JDBC with valid 
ASCII credentials, Spark 3.5.9, Java 17, and `spark.master=local[2]`. Changing 
only the share level to `SERVER` allowed the same connection checks and SQL 
queries to pass.
   
   ### Affects Version(s)
   
   master at 
[f3125812e364ad1ad687d2e57b693de114a4991d](https://github.com/apache/kyuubi/commit/f3125812e364ad1ad687d2e57b693de114a4991d),
 using 1.13.0-SNAPSHOT artifacts. The first affected release has not been 
established.
   
   ### Steps to reproduce
   
   1. Start a Kyuubi server with a Spark SQL engine and the configuration below.
   2. Open a regular JDBC connection with valid credentials and wait for engine 
OpenSession.
   3. Observe the exception below. A query such as `SELECT 1` cannot run 
because session creation fails.
   4. Set `kyuubi.engine.share.level=SERVER` and restart with a fresh engine as 
a comparison.
   
   ### Kyuubi Server Configurations
   
   ```properties
   kyuubi.engine.type=SPARK_SQL
   kyuubi.engine.share.level=SERVER_LOCAL
   kyuubi.engine.doAs.enabled=false
   kyuubi.engine.single.spark.session=false
   kyuubi.engine.user.isolated.spark.session=true
   spark.master=local[2]
   ```
   
   ### Kyuubi Engine Log Output
   
   ```text
   Caused by: java.lang.RuntimeException: scala.MatchError:
   SERVER_LOCAL (of class scala.Enumeration$Val)
     at 
SparkSQLSessionManager.getOrNewSparkSession(SparkSQLSessionManager.scala:112)
   ```
   
   ### Suggested direction
   
   In 
[SparkSQLSessionManager.getOrNewSparkSession](https://github.com/apache/kyuubi/blob/f3125812e364ad1ad687d2e57b693de114a4991d/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala#L109-L136),
 the share-level match handles `CONNECTION`, `USER`, `GROUP`, and `SERVER`, but 
omits `SERVER_LOCAL`.
   
   Consider handling `SERVER_LOCAL` alongside `SERVER` in both the guarded 
per-connection branch and the per-user cache branch. Preserve the server-side 
engine discovery/routing boundary: `SERVER_LOCAL` shares an engine within the 
server that launched it.
   
   ### Regression coverage
   
   Please verify through OpenSession, SQL, and CloseSession:
   
   - With single-session mode disabled and user isolation enabled, two 
connections for the same user have independent temporary views and SQLConf.
   - With user isolation disabled, the same user reuses session state, 
different users remain isolated, and reference counting and idle eviction 
preserve active sessions.
   - Closing one connection leaves other connections usable.
   - Explicit single-session mode and existing share levels retain their 
behavior.
   
   A local candidate and regression tests confirmed the missing match cases: 
the three new tests fail without the candidate, including the original 
`MatchError`, and pass with it. No fix PR is being submitted; contributions are 
welcome. I can help reproduce the issue and validate a proposed fix.
   
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [I] [Bug] Spark engine fail... wangzhigang1999 (via GitHub) via notifications

Reply via email to