zhang-arvin opened a new pull request, #7680:
URL: https://github.com/apache/kyuubi/pull/7680

   ### What changes were proposed in this pull request?
   
   Change the main thread blocking wait from `countDownLatch.await()` to a 
polling loop that also observes the SparkContext state. When the SparkContext 
is stopped unexpectedly (e.g., OutOfMemoryError), the main thread breaks the 
wait instead of hanging forever.
   
   ### Why are the changes needed?
   
   When an uncaught error such as an OutOfMemoryError stops the SparkContext, 
the engine shutdown can start on another thread but stall before reaching 
`stopServer()`. Since the `countDownLatch` is only released by `stopServer()`, 
the main thread waits forever even though the SparkContext has already stopped. 
In YARN cluster mode this can leave the application master process alive after 
the driver RPC endpoint has gone away.
   
   ### How was this patch tested?
   
   Manually verified the code change. The fix uses the same `isStopped` check 
already used by the terminating checker in `SparkSQLSessionManager`.
   
   ### Does this PR introduce any user-facing change?
   
   No.
   
   Closes #7590


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