advancedxy commented on a change in pull request #23638: [SPARK-26713][CORE] 
Interrupt pipe IO threads in PipedRDD when task is finished
URL: https://github.com/apache/spark/pull/23638#discussion_r251677505
 
 

 ##########
 File path: 
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
 ##########
 @@ -395,7 +402,7 @@ final class ShuffleBlockFetcherIterator(
     // then fetch it one more time if it's corrupt, throw FailureFetchResult 
if the second fetch
     // is also corrupt, so the previous stage could be retried.
     // For local shuffle block, throw FailureFetchResult for the first 
IOException.
-    while (result == null) {
+    while (!isZombie && result == null) {
 
 Review comment:
   > is it possible that hasNext returns true and next throws 
NoSuchElementException? isZombie may get changed by other threads?
   
   @cloud-fan Yeah, it can happen. But I agree with @srowen. The `isZombie` 
flag indicates the whole task is finished, there's no point for the consumer of 
the iterator to be still active. This  changes the semantics of `Iterator` at 
rare chances,  but I think it is acceptable.
   
   > We could follow this up with small things like making `hasNext()` 
synchronized at least, as `isZombie` is marked `GuardedBy("this")`. That still 
doesn't prevent this from happening but is a little tighter.
   
   Maybe. But I would leave it as it's if It's up to me. Like you said, this 
doesn't prevent the semantics changing but a little tighter.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

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

Reply via email to