Github user zsxwing commented on a diff in the pull request:

    https://github.com/apache/spark/pull/11138#discussion_r52360044
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala 
---
    @@ -154,13 +164,13 @@ final class ShuffleBlockFetcherIterator(
             override def onBlockFetchSuccess(blockId: String, buf: 
ManagedBuffer): Unit = {
               // Only add the buffer to results queue if the iterator is not 
zombie,
               // i.e. cleanup() has not been called yet.
    -          if (!isZombie) {
    -            // Increment the ref count because we need to pass this to a 
different thread.
    -            // This needs to be released after use.
    -            buf.retain()
    -            results.put(new SuccessFetchResult(BlockId(blockId), address, 
sizeMap(blockId), buf))
    -            shuffleMetrics.incRemoteBytesRead(buf.size)
    -            shuffleMetrics.incRemoteBlocksFetched(1)
    +          ShuffleBlockFetcherIterator.this.synchronized {
    --- End diff --
    
    If we don't use a lock here, `isZombie` may become to `true` after `if 
(!isZombie) {`. Then we may put `SuccessFetchResult` into results after 
cleaning up it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to