[Bug] Spark engine fails to open sessions with SERVER_LOCAL share level
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 55/100
Research direction
Read externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/session/SparkSQLSessionManager.scala, especially getOrNewSparkSession around line 112, where the issue reports that SERVER_LOCAL is missing from the share-level match. Trace the server-side engine discovery and session routing before changing the branches. Add regression coverage for OpenSession, SQL, and CloseSession across the listed isolation and share-level cases; done means session state and connection behavior match those expectations.
Written by the indexing model from the issue text.
Description
Code of Conduct
- I agree to follow this project's Code of Conduct
Search before asking
- I have searched in the issues and found no similar issues.
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.
Steps to reproduce:
- Start a Kyuubi server with a Spark SQL engine and the configuration below.
- Open a regular JDBC connection with valid credentials and wait for engine OpenSession.
- Observe the exception below. A query such as
SELECT 1cannot run because session creation fails. - Set
kyuubi.engine.share.level=SERVERand restart with a fresh engine as a comparison.
Affects Version(s)
master at f3125812e364ad1ad687d2e57b693de114a4991d, using 1.13.0-SNAPSHOT artifacts. The first affected release has not been established.
Kyuubi Server Log Output
The client reports the engine OpenSession exception shown below.
Kyuubi Engine Log Output
Caused by: java.lang.RuntimeException: scala.MatchError:
SERVER_LOCAL (of class scala.Enumeration$Val)
at SparkSQLSessionManager.getOrNewSparkSession(SparkSQLSessionManager.scala:112)
Kyuubi Server Configurations
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
Kyuubi Engine Configurations
spark.master=local[2]
Additional context
Contributions are welcome.
In SparkSQLSessionManager.getOrNewSparkSession, 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.
Suggested 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.
Are you willing to submit PR?
- Yes. I would be willing to submit a PR with guidance from the Kyuubi community to fix.
- No. I cannot submit a PR at this time.
- Dominant language
- Scala
- Stars
- 2.4k
- Forks
- 1k
- Avg merge
- 18h 17m
- Merged PRs (30d)
- 1
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/kyuubi
-
kind:bug priority:major
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
[Bug] HiveDialect shares its colspecs dict with SQLAlchemy's DefaultDialect (python/pyhive)Possibly taken @rusackas claimed this 22 days ago. Open
Difficulty 1/5 Under an hour Newbie friendliness 80/100
apache/kyuubi#7786 · 1 comment ·
Maintainers usually reply within 1 day
-
isClassLoadable answers false on threads without a context classloaderPossibly taken @LuciferYang claimed this 57 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
kind:feature priority:major
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
apache/kyuubi#7454 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
-
[Bug] LDAP Login Error | Password with Special Characters § ß ö ä ü € not workingPossibly taken @wangzhigang1999 claimed this 2 days ago. Openkind:bug priority:major
Difficulty 3/5 1-2 days Newbie friendliness 55/100
apache/kyuubi#7842 · 1 comment ·
Maintainers usually reply within 1 day
Similar issues
-
Area: PDF support
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
orbeon/orbeon-forms#8055 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
lichess-org/database#103 ·
-
[BUG] The LZ4 shuffle decompressor leaks a reference on its inputs when an output allocation failsOpen? - Needs Triage bug shuffle
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
NVIDIA/cudf-spark#16770 ·
Maintainers usually reply within 1 day
-
Spark benchmarks crash with `[INVALID_DRIVER_MEMORY]` on JVMs whose default heap is below Spark's ~450 MB minimumPossibly taken @sendaoYan claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
-
Static data: Add @id in Organization static contentPossibly taken A pull request linked to this issue is open or already merged. OpenSEO
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
lichess-org/lila#22409 ·
Maintainers usually reply within 1 day