beliefer commented on code in PR #50020:
URL: https://github.com/apache/spark/pull/50020#discussion_r1981444179


##########
core/src/main/scala/org/apache/spark/BarrierCoordinator.scala:
##########
@@ -80,8 +81,9 @@ private[spark] class BarrierCoordinator(
       states.forEachValue(1, clearStateConsumer)
       states.clear()
       listenerBus.removeListener(listener)
-      ThreadUtils.shutdown(timer)
     } finally {
+      timerFuture.foreach(_.cancel(true))
+      ThreadUtils.shutdown(timer)

Review Comment:
   May be we can change `newSingleThreadScheduledExecutor` to 
`newDaemonSingleThreadScheduledExecutor` or let `TimerTask` could response the 
interrupt.
   
   ```
         timerTask = new TimerTask {
           override def run(): Unit = {
             try {
               state.synchronized {
                 // Timeout current barrier() call, fail all the sync requests.
                 requesters.foreach(_.sendFailure(new SparkException("The 
coordinator didn't get all " +
                   s"barrier sync requests for barrier epoch $barrierEpoch from 
$barrierId within " +
                   s"$timeoutInSecs second(s).")))
                 cleanupBarrierStage(barrierId)
               }
             } catch {
               case ie: InterruptedException => // Ignore, and break.
             }
           }
         }
   ```



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to