dajiaohuang commented on code in PR #7797:
URL: https://github.com/apache/kyuubi/pull/7797#discussion_r4396222018


##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala:
##########
@@ -410,7 +409,14 @@ object SparkSQLEngine extends Logging {
         try {
           startEngine(spark)
           // blocking main thread
-          countDownLatch.await()
+          // The engine may not reach stopServer after SparkContext shutdown 
starts.
+          while (!countDownLatch.await(1, TimeUnit.SECONDS)) {
+            if (spark.sparkContext.isStopped) {
+              // stop() may already be running, so exit the wait instead of 
calling it again.
+              warn("SparkContext has been stopped, breaking main thread wait")
+              return

Review Comment:
   Implemented in `17c5766`: if SparkContext stops before the latch is 
released, the main thread now throws `KyuubiException` and uses the existing 
engine error path to stop/report abnormal termination. I updated the loop 
comment as well. Tests were not rerun because the protected shared Zinc-cache 
restriction remains; the PR description now states that limit.



##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala:
##########
@@ -227,7 +227,6 @@ object SparkSQLEngine extends Logging {
   private lazy val user = currentUser
 
   private val countDownLatch = new CountDownLatch(1)
-

Review Comment:
   Reverted the unrelated blank-line removal in `SparkSQLEngine.scala`.



-- 
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]

Reply via email to