Github user cloud-fan commented on a diff in the pull request:
https://github.com/apache/spark/pull/17244#discussion_r106318801
--- Diff: core/src/main/scala/org/apache/spark/TaskContextImpl.scala ---
@@ -52,62 +63,79 @@ private[spark] class TaskContextImpl(
@volatile private var interrupted: Boolean = false
// Whether the task has completed.
- @volatile private var completed: Boolean = false
+ private var completed: Boolean = false
// Whether the task has failed.
- @volatile private var failed: Boolean = false
+ 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
- override def addTaskCompletionListener(listener:
TaskCompletionListener): this.type = {
- onCompleteCallbacks += listener
+ @GuardedBy("this")
+ override def addTaskCompletionListener(listener: TaskCompletionListener)
+ : this.type = synchronized {
+ if (completed) {
+ listener.onTaskCompletion(this)
--- End diff --
shall we also try catch here?
---
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]