You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2025/01/23 00:06:38 UTC

(spark) branch master updated: Revert "[SPARK-50118][CONNET] Reset isolated state cache when tasks are running"

This is an automated email from the ASF dual-hosted git repository.

gurwls223 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new 3bbb12cbd5e6 Revert "[SPARK-50118][CONNET] Reset isolated state cache when tasks are running"
3bbb12cbd5e6 is described below

commit 3bbb12cbd5e67f725b8a31057370e332bdf19d8d
Author: Hyukjin Kwon <gu...@apache.org>
AuthorDate: Thu Jan 23 09:06:09 2025 +0900

    Revert "[SPARK-50118][CONNET] Reset isolated state cache when tasks are running"
    
    This reverts commit 7ba279a3ff76bd17f25035ced90ea882812dfac8.
---
 .../scala/org/apache/spark/executor/Executor.scala  | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/core/src/main/scala/org/apache/spark/executor/Executor.scala b/core/src/main/scala/org/apache/spark/executor/Executor.scala
index f1087b695a7d..6ad5087283ee 100644
--- a/core/src/main/scala/org/apache/spark/executor/Executor.scala
+++ b/core/src/main/scala/org/apache/spark/executor/Executor.scala
@@ -22,7 +22,7 @@ import java.lang.Thread.UncaughtExceptionHandler
 import java.lang.management.ManagementFactory
 import java.net.{URI, URL}
 import java.nio.ByteBuffer
-import java.util.{Locale, Properties, Timer, TimerTask}
+import java.util.{Locale, Properties}
 import java.util.concurrent._
 import java.util.concurrent.atomic.AtomicBoolean
 import java.util.concurrent.locks.ReentrantLock
@@ -209,10 +209,9 @@ private[spark] class Executor(
   // The default isolation group
   val defaultSessionState: IsolatedSessionState = newSessionState(JobArtifactState("default", None))
 
-  private val cacheExpiryTime = 30 * 60 * 1000
   val isolatedSessionCache: Cache[String, IsolatedSessionState] = CacheBuilder.newBuilder()
     .maximumSize(100)
-    .expireAfterAccess(cacheExpiryTime, TimeUnit.MILLISECONDS)
+    .expireAfterAccess(30, TimeUnit.MINUTES)
     .removalListener(new RemovalListener[String, IsolatedSessionState]() {
       override def onRemoval(
           notification: RemovalNotification[String, IsolatedSessionState]): Unit = {
@@ -296,8 +295,6 @@ private[spark] class Executor(
 
   private val pollOnHeartbeat = if (METRICS_POLLING_INTERVAL_MS > 0) false else true
 
-  private val timer = new Timer("executor-state-timer", true)
-
   // Poller for the memory metrics. Visible for testing.
   private[executor] val metricsPoller = new ExecutorMetricsPoller(
     env.memoryManager,
@@ -448,9 +445,6 @@ private[spark] class Executor(
         case NonFatal(e) =>
           logWarning("Unable to stop heartbeater", e)
       }
-      if (timer != null) {
-        timer.cancel()
-      }
       ShuffleBlockPusher.stop()
       if (threadPool != null) {
         threadPool.shutdown()
@@ -565,17 +559,9 @@ private[spark] class Executor(
     override def run(): Unit = {
 
       // Classloader isolation
-      var maybeTimerTask: Option[TimerTask] = None
       val isolatedSession = taskDescription.artifacts.state match {
         case Some(jobArtifactState) =>
-          val state = isolatedSessionCache.get(
-            jobArtifactState.uuid, () => newSessionState(jobArtifactState))
-          maybeTimerTask = Some(new TimerTask {
-            // Resets the expire time till the task ends.
-            def run(): Unit = isolatedSessionCache.getIfPresent(jobArtifactState.uuid)
-          })
-          maybeTimerTask.foreach(timer.schedule(_, cacheExpiryTime / 10, cacheExpiryTime / 10))
-          state
+          isolatedSessionCache.get(jobArtifactState.uuid, () => newSessionState(jobArtifactState))
         case _ => defaultSessionState
       }
 
@@ -876,7 +862,6 @@ private[spark] class Executor(
             uncaughtExceptionHandler.uncaughtException(Thread.currentThread(), t)
           }
       } finally {
-        maybeTimerTask.foreach(_.cancel)
         cleanMDCForTask(taskName, mdcProperties)
         runningTasks.remove(taskId)
         if (taskStarted) {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org