You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2019/02/24 17:59:02 UTC

[GitHub] kiszk commented on a change in pull request #23842: [SPARK-26927]Fix race condition may cause dynamic allocation not working

kiszk commented on a change in pull request #23842: [SPARK-26927]Fix race condition may cause dynamic allocation not working
URL: https://github.com/apache/spark/pull/23842#discussion_r259632626
 
 

 ##########
 File path: core/src/main/scala/org/apache/spark/ExecutorAllocationManager.scala
 ##########
 @@ -566,6 +574,13 @@ private[spark] class ExecutorAllocationManager(
     if (executorIds.contains(executorId)) {
       executorIds.remove(executorId)
       removeTimes.remove(executorId)
+      if (!removedExecutorIds.offer(executorId)) {
+        logWarning(s"The queue is full for tracking removed executors, will trim old " +
+          s"executor ids and offer again")
+        val trimSize = math.max(1, removedExecutorIds.size() / 10)
+        (0 to trimSize).foreach(removedExecutorIds.poll())
+        removedExecutorIds.offer(executorId)
 
 Review comment:
   Can we ensure that this `offer` always succeed?  If `removedExecutorIds` uses `LinkedBlockingQueue` for multi-threading, line 577 is executed on multi-threads while line 581 is running. In that case, line 582 may see full queue again.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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