-
Notifications
You must be signed in to change notification settings - Fork 980
[KYUUBI #7163][SPARK] Check whether engine context stopped in engine terminating checker #7167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
03c3bfc to
ca551c2
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7167 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 701 701
Lines 43515 43521 +6
Branches 5897 5899 +2
======================================
- Misses 43515 43521 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
pan3793
reviewed
Aug 7, 2025
kyuubi-common/src/main/scala/org/apache/kyuubi/session/SessionManager.scala
Show resolved
Hide resolved
pan3793
reviewed
Aug 7, 2025
kyuubi-common/src/main/scala/org/apache/kyuubi/session/SessionManager.scala
Outdated
Show resolved
Hide resolved
pan3793
approved these changes
Aug 7, 2025
This reverts commit cf9e40e.
turboFei
added a commit
that referenced
this pull request
Aug 7, 2025
…terminating checker ### Why are the changes needed? To close #7163, in this PR, it checks whether engine context stopped in engine terminating checker. 1. Spark context stooped dut to OOM in `spark-listener-group-shared`, and call `tryOrStopSparkContext`. ``` 25/08/03 19:08:06 ERROR Utils: uncaught error in thread spark-listener-group-shared, stopping SparkContext java.lang.OutOfMemoryError: GC overhead limit exceeded 25/08/03 19:08:06 INFO OperationAuditLogger: operation=a7f134b9-373b-402d-a82b-2d42df568807 opType=ExecuteStatement state=INITIALIZED user=b_hrvst session=6a90d01c-7627-4ae6-a506-7ba826355489 ... 25/08/03 19:08:23 INFO SparkSQLSessionManager: Opening session for b_hrvst10.147.254.115 25/08/03 19:08:23 ERROR SparkTBinaryFrontendService: Error opening session: org.apache.kyuubi.KyuubiSQLException: Cannot call methods on a stopped SparkContext. This stopped SparkContext was created at: org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:951) org.apache.kyuubi.engine.spark.SparkSQLEngine$.createSpark(SparkSQLEngine.scala:337) org.apache.kyuubi.engine.spark.SparkSQLEngine$.main(SparkSQLEngine.scala:415) org.apache.kyuubi.engine.spark.SparkSQLEngine.main(SparkSQLEngine.scala) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:732) The currently active SparkContext was created at: org.apache.spark.sql.SparkSession$Builder.getOrCreate(SparkSession.scala:951) org.apache.kyuubi.engine.spark.SparkSQLEngine$.createSpark(SparkSQLEngine.scala:337) org.apache.kyuubi.engine.spark.SparkSQLEngine$.main(SparkSQLEngine.scala:415) org.apache.kyuubi.engine.spark.SparkSQLEngine.main(SparkSQLEngine.scala) sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:498) org.apache.spark.deploy.yarn.ApplicationMaster$$anon$2.run(ApplicationMaster.scala:732) at org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:69) at org.apache.kyuubi.KyuubiSQLException$.apply(KyuubiSQLException.scala:73) ``` 2. The kyuubi engine stop after 12 hours. ``` 25/08/04 07:13:25 ERROR ZookeeperDiscoveryClient: Zookeeper client connection state changed to: LOST, but failed to reconnect in 3 seconds. Give up retry and stop gracefully . 25/08/04 07:13:25 INFO ClientCnxn: Session establishment complete on server zeus-slc-zk-3.vip.hadoop.ebay.com/10.147.141.240:2181, sessionid = 0x3939e22c983032e, negotiated timeout = 40000 25/08/04 07:13:25 INFO ConnectionStateManager: State change: RECONNECTED 25/08/04 07:13:25 INFO ZookeeperDiscoveryClient: Zookeeper client connection state changed to: RECONNECTED 25/08/04 07:13:25 INFO SparkSQLEngine: Service: [SparkTBinaryFrontend] is stopping. 25/08/04 07:13:25 INFO SparkTBinaryFrontendService: Service: [EngineServiceDiscovery] is stopping. 25/08/04 07:13:25 WARN EngineServiceDiscovery: The Zookeeper ensemble is LOST 25/08/04 07:13:25 INFO EngineServiceDiscovery: Service[EngineServiceDiscovery] is stopped. 25/08/04 07:13:25 INFO SparkTBinaryFrontendService: Service[SparkTBinaryFrontend] is stopped. 25/08/04 07:13:25 INFO SparkTBinaryFrontendService: SparkTBinaryFrontend has stopped 25/08/04 07:13:25 INFO SparkSQLEngine: Service: [SparkSQLBackendService] is stopping. 25/08/04 07:13:25 INFO SparkSQLBackendService: Service: [SparkSQLSessionManager] is stopping. 25/08/04 07:13:25 INFO SparkSQLSessionManager: Service: [SparkSQLOperationManager] is stopping. 25/08/04 07:13:45 INFO SparkSQLOperationManager: Service[SparkSQLOperationManager] is stopped. 25/08/04 07:13:45 INFO SparkSQLSessionManager: Service[SparkSQLSessionManager] is stopped. ``` 3. seem the shutdown hook does not work in such case https://github.com/apache/kyuubi/blob/9a0c49e79135cd90368986176591a80d29634231/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala#L375-L376 4. and `SparkSQLEngineListener` did not receive `ApplicationEnd` message, maybe due to `spark-listener-group-shared` OOM? I do not have jstack for that, and can not check whether the thread alive. https://github.com/apache/kyuubi/blob/9a0c49e79135cd90368986176591a80d29634231/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/spark/kyuubi/SparkSQLEngineListener.scala#L55-L63 ### How was this patch tested? Existing GA. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #7167 from turboFei/check_spark_stopped. Closes #7163 835cb3d [Wang, Fei] SparkContext cd542de [Wang, Fei] Revert "no hard code" cf9e40e [Wang, Fei] no hard code ca551c2 [Wang, Fei] check engine context stopped Authored-by: Wang, Fei <[email protected]> Signed-off-by: Wang, Fei <[email protected]> (cherry picked from commit b31663f) Signed-off-by: Wang, Fei <[email protected]>
Member
Author
|
thanks, merged to 1.11.0 and 1.10.3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
To close #7163, in this PR, it checks whether engine context stopped in engine terminating checker.
spark-listener-group-shared, and calltryOrStopSparkContext.seem the shutdown hook does not work in such case
kyuubi/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala
Lines 375 to 376 in 9a0c49e
and
SparkSQLEngineListenerdid not receiveApplicationEndmessage, maybe due tospark-listener-group-sharedOOM? I do not have jstack for that, and can not check whether the thread alive.kyuubi/externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/spark/kyuubi/SparkSQLEngineListener.scala
Lines 55 to 63 in 9a0c49e
How was this patch tested?
Existing GA.
Was this patch authored or co-authored using generative AI tooling?
No.