spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jisoo Kim (JIRA)" <>
Subject [jira] [Commented] (SPARK-19698) Race condition in stale attempt task completion vs current attempt task completion when task is doing persistent state changes
Date Fri, 24 Feb 2017 01:54:44 GMT


Jisoo Kim commented on SPARK-19698:

Ah, I see what you mean. I don't use Spark's speculation feature, so I wasn't aware that the
running tasks won't be killed when their speculative copies get restarted. What is the reason
behind not killing the stale tasks that were overridden? Is that for performance? 

I found that TaskSetManager will kill all the other attempts for the specific task when one
of the attempts succeeds:

However, the above scenario still concerns me in case the task has some other long-running
computation after modifying external state. In that case, Attempt 1 can be launched after
Attempt 0 finishes modifying external state (but is still doing some computation) and gets
partway through its own modification. I think in this case if Attempt 1 gets killed or all
other partitions are "finished" before Attempt 1 finishes, the same problem can happen. 

I wonder if this approach is a viable solution:
- Have additional information (task attemptNumber from task info) when adding the task index
to speculableTasks (
- Have TaskSetManager to notify the driver only when the completed task is not inside speculableTasks

> Race condition in stale attempt task completion vs current attempt task completion when
task is doing persistent state changes
> ------------------------------------------------------------------------------------------------------------------------------
>                 Key: SPARK-19698
>                 URL:
>             Project: Spark
>          Issue Type: Bug
>          Components: Mesos, Spark Core
>    Affects Versions: 2.0.0
>            Reporter: Charles Allen
> We have encountered a strange scenario in our production environment. Below is the best
guess we have right now as to what's going on.
> Potentially, the final stage of a job has a failure in one of the tasks (such as OOME
on the executor) which can cause tasks for that stage to be relaunched in a second attempt.
> keeps track of which tasks have been completed, but does NOT keep track of which attempt
those tasks were completed in. As such, we have encountered a scenario where a particular
task gets executed twice in different stage attempts, and the DAGScheduler does not consider
if the second attempt is still running. This means if the first task attempt succeeded, the
second attempt can be cancelled part-way through its run cycle if all other tasks (including
the prior failed) are completed successfully.
> What this means is that if a task is manipulating some state somewhere (for example:
a upload-to-temporary-file-location, then delete-then-move on an underlying s3n storage implementation)
the driver can improperly shutdown the running (2nd attempt) task between state manipulations,
leaving the persistent state in a bad state since the 2nd attempt never got to complete its
manipulations, and was terminated prematurely at some arbitrary point in its state change
logic (ex: finished the delete but not the move).
> This is using the mesos coarse grained executor. It is unclear if this behavior is limited
to the mesos coarse grained executor or not.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message