srowen commented on a change in pull request #26315: [SPARK-29152][CORE] 
Executor Plugin shutdown when dynamic allocation is enabled
URL: https://github.com/apache/spark/pull/26315#discussion_r345195838
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/executor/Executor.scala
 ##########
 @@ -278,35 +283,38 @@ private[spark] class Executor(
   }
 
   def stop(): Unit = {
-    env.metricsSystem.report()
-    try {
-      metricsPoller.stop()
-    } catch {
-      case NonFatal(e) =>
-        logWarning("Unable to stop executor metrics poller", e)
-    }
-    try {
-      heartbeater.stop()
-    } catch {
-      case NonFatal(e) =>
-        logWarning("Unable to stop heartbeater", e)
-    }
-    threadPool.shutdown()
-
-    // Notify plugins that executor is shutting down so they can terminate 
cleanly
-    Utils.withContextClassLoader(replClassLoader) {
-      executorPlugins.foreach { plugin =>
-        try {
-          plugin.shutdown()
-        } catch {
-          case e: Exception =>
-            logWarning("Plugin " + plugin.getClass().getCanonicalName() + " 
shutdown failed", e)
+    if (!executorShutdown.get()) {
+      executorShutdown.compareAndSet(false, true)
 
 Review comment:
   This won't work to separately check and set the value; it loses the 
atomic-ness.
   Really it just needs to be `if (!executorShutdown.getAndSet(true))`

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to