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

    https://github.com/apache/spark/pull/17244#discussion_r105490080
  
    --- Diff: core/src/main/scala/org/apache/spark/TaskContextImpl.scala ---
    @@ -57,57 +68,75 @@ private[spark] class TaskContextImpl(
       // Whether the task has failed.
       @volatile private var failed: Boolean = false
     
    +  // Throwable that caused the task to fail
    +  private var failure: Throwable = _
    +
       // If there was a fetch failure in the task, we store it here, to make 
sure user-code doesn't
       // hide the exception.  See SPARK-19276
       @volatile private var _fetchFailedException: 
Option[FetchFailedException] = None
     
    +  @GuardedBy("this")
       override def addTaskCompletionListener(listener: 
TaskCompletionListener): this.type = {
    -    onCompleteCallbacks += listener
    +    synchronized {
    +      if (completed) {
    +        listener.onTaskCompletion(this)
    +      }
    +      // Always add the listener because it is legal to call them multiple 
times.
    --- End diff --
    
    I did not realize this, interesting !


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