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

    https://github.com/apache/spark/pull/9264#discussion_r44573118
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/JobWaiter.scala ---
    @@ -49,29 +51,14 @@ private[spark] class JobWaiter[T](
         dagScheduler.cancelJob(jobId)
       }
     
    -  override def taskSucceeded(index: Int, result: Any): Unit = synchronized 
{
    -    if (_jobFinished) {
    -      throw new UnsupportedOperationException("taskSucceeded() called on a 
finished JobWaiter")
    -    }
    +  override def taskSucceeded(index: Int, result: Any): Unit = {
    --- End diff --
    
    Hmm... I see what you mean. While nothing within `JobWaiter` itself needs 
protection here, in probably all cases `resultHandler` is writing to an array, 
which seems like it should it should be okay since each thread would be writing 
to a different index in the array, but in practice probably isn't due to 
funkiness in the Java memory model. At the very least, synchronization is 
necessary to ensure that all writes have been flushed before returning the 
final result back from the various incarnations of `runJob`. I'll wrap the 
`resultHandler` call in a `synchronized` block and add a comment.


---
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