pan3793 commented on code in PR #6040:
URL: https://github.com/apache/kyuubi/pull/6040#discussion_r1479131067
##########
externals/kyuubi-spark-sql-engine/src/main/scala/org/apache/kyuubi/engine/spark/SparkSQLEngine.scala:
##########
@@ -170,18 +170,41 @@ case class SparkSQLEngine(spark: SparkSession) extends
Serverable("SparkSQLEngin
val maxLifetime = conf.get(ENGINE_SPARK_MAX_LIFETIME)
val deregistered = new AtomicBoolean(false)
if (maxLifetime > 0) {
+ val gracefulPeriod = conf.get(ENGINE_SPARK_MAX_LIFETIME_GRACEFUL_PERIOD)
val checkTask: Runnable = () => {
- if (!shutdown.get && System.currentTimeMillis() - getStartTime >
maxLifetime) {
+ val elapsedTime = System.currentTimeMillis() - getStartTime
+ if (!shutdown.get && elapsedTime > maxLifetime) {
if (deregistered.compareAndSet(false, true)) {
- info(s"Spark engine has been running for more than $maxLifetime
ms," +
- s" deregistering from engine discovery space.")
- frontendServices.flatMap(_.discoveryService).foreach(_.stop())
+ ThreadUtils.runInNewThread("engine-de-register", isDaemon = false)
{
+ // for ETCD, the de-registering process might be blocked, so
deregister it async
+ info(s"Spark engine has been running for more than $maxLifetime
ms," +
+ s" deregistering from engine discovery space.")
+ frontendServices.flatMap(_.discoveryService).foreach(_.stop())
Review Comment:
Emm... why blocking occur?
--
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]