Skip to content

[KYUUBI #7590][SPARK] Exit engine when SparkContext stops - #7592

Closed
turboFei wants to merge 1 commit into
apache:masterfrom
turboFei:kyuubi-7590-exit-stopped-spark-engine
Closed

[KYUUBI #7590][SPARK] Exit engine when SparkContext stops#7592
turboFei wants to merge 1 commit into
apache:masterfrom
turboFei:kyuubi-7590-exit-stopped-spark-engine

Conversation

@turboFei

Copy link
Copy Markdown
Member

Why are the changes needed?

Closes #7590.

After SparkContext stops, engine shutdown can stall before stopServer releases the
main-thread latch. In that state, SparkSQLEngine waits indefinitely and leaves a
zombie engine process.

This patch checks the SparkContext state while waiting for normal engine shutdown.
It also rechecks the latch before reporting failure so that a concurrent normal
shutdown wins the race.

How was this patch tested?

Added tests for both the stopped-SparkContext path and the concurrent normal-shutdown
path.

mvn test -pl :kyuubi-spark-sql-engine_2.12 -am \
  -Dtest=none \
  -DwildcardSuites=org.apache.kyuubi.engine.spark.SparkSQLEngineSuite

Result: 3 tests passed.

Also ran the repository Spotless formatter.

Was this patch authored or co-authored using generative AI tooling?

Assisted-by: OpenAI Codex with GPT-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Spark SQL engine main thread can wait forever after SparkContext stops

1 participant