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

    https://github.com/apache/spark/pull/16252#discussion_r91955148
  
    --- Diff: 
core/src/main/scala/org/apache/spark/storage/memory/MemoryStore.scala ---
    @@ -694,7 +694,7 @@ private[storage] class PartiallyUnrolledIterator[T](
       }
     
       override def next(): T = {
    -    if (unrolled == null) {
    +    if (unrolled == null || unrolled.isEmpty) {
    --- End diff --
    
    @wangyum This bug happens because in `TorrentBroadcast.readBroadcastBlock`, 
we directly call `next()` without calling `hasNext()` first which can null out 
`unrolled`.
    
    You can check out
    
https://github.com/apache/spark/blob/7d5cb3af7621ad6eb85d1ba7f585c3921ca0a242/core/src/main/scala/org/apache/spark/broadcast/TorrentBroadcast.scala#L210
    
    Calling `hasNext()` before `next()` can fix this too. But this fixing is 
simpler and I think it should be ok.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to