You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "lyy-pineapple (via GitHub)" <gi...@apache.org> on 2023/06/25 11:34:52 UTC
[GitHub] [spark] lyy-pineapple opened a new pull request, #41723: [SPARK-44179][CORE]:Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
lyy-pineapple opened a new pull request, #41723:
URL: https://github.com/apache/spark/pull/41723
### What changes were proposed in this pull request?
The dynamic scheduler listener keeps track of the number of running speculative tasks. When a task fails and is not a speculative task, and its corresponding speculative task is still running, the stageAttemptToTaskIndices will not remove the task index.
### Why are the changes needed?
Assuming a stage has Task 1, with Task 1.0 and a speculative task Task 1.1 running concurrently, the dynamic scheduler calculates the number of executors as 2 (pendingTask: 0, pendingSpeculative: 0, running: 2).
At this point, Task 1.0 fails, and the dynamic scheduler recalculates the number of executors as 2 (pendingTask: 1, pendingSpeculative: 0, running: 1).
Due to the failure of Task 1.0, copyRunning(1) becomes 1. As a result, Task 1 is speculated again and a SparkListenerSpeculativeTaskSubmitted event is triggered. However, the dynamic scheduler's calculation for the number of executors becomes 3 (pendingTask: 1, pendingSpeculative: 1, running: 1), which is obviously not as expected.
Then, Task 1.2 starts, and it is marked as a speculative task. However, the dynamic scheduler still calculates the number of executors as 3 (pendingTask: 1, pendingSpeculative: 1, running: 1), which again is not as expected.
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
add ut
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] mridulm commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1659460639
Yes, that condition would need to be relooked into as well, good point.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] mridulm commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1620982717
We already have a speculative task running, and have scheduled the retry for the task when it failed ... so I dont see an issue with adding the condition ... having said that, given how sensitive this code is, will wait for @Ngone51 to also take a look.
Also, +CC @JoshRosen, @jiangxb1987 in case you have bandwidth to look into this :-) Would love an extra pair of eyes on this.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] mridulm commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1615415367
The issue here is in `TaskSetManager` (tsm), not `ExecutorAllocationManager`.
The scenario you laid out is correct, namely:
Initial state:
* For partition P, original task T1 = 1.0 and speculative task T2 = 1.1
* `speculatableTasks` is empty, since 1.1 has started already.
T1 fails [1]:
* tsm.`handleFailedTask` adds the task again (`addPendingTask` at the end).
* This in turn adds P to all the task lists
Assuming [1] has not yet been scheduled and we have `checkSpeculatableTasks` invoked.
The condition in `checkAndSubmitSpeculatableTasks` will be true, namely : `!successful(index) && copiesRunning(index) == 1 && !speculatableTasks.contains(index)`.
Hence we add a speculative task for schedule.
This is the reason why we have 3 pending tasks - the running speculated task, the re-added task from failure, and the new speculative task.
So what `ExecutorAllocationManager` is doing is IMO correct - what is incorrect is addition of the second speculative task itself.
The fix would be to change the condition in `checkAndSubmitSpeculatableTasks` to something like:
```
!successful(index) && copiesRunning(index) == 1 && !speculatableTasks.contains(index) &&
// make sure the currently running copy is not a speculative task
!info.speculative
```
+CC @Ngone51 as well, since this is a bit more involved change (though a 1 line change :-) )
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing [spark]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1804878133
We're closing this PR because it hasn't been updated in a while. This isn't a judgement on the merit of the PR in any way. It's just a way of keeping the PR queue manageable.
If you'd like to revive this PR, please reopen it and ask a committer to remove the Stale tag!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] lyy-pineapple commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "lyy-pineapple (via GitHub)" <gi...@apache.org>.
lyy-pineapple commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1621077222
if we already have a speculative task running, and failed task would not retry because `dequeueTaskFromList` need copiesRunning(index) == 0:
` if (!successful(index)) {
if (copiesRunning(index) == 0) {
return Some(index)
} else if (speculative && copiesRunning(index) == 1) {
return Some(index)
}
}`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] lyy-pineapple commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "lyy-pineapple (via GitHub)" <gi...@apache.org>.
lyy-pineapple commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1608660638
cc @cloud-fan @LuciferYang thanks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing [spark]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
URL: https://github.com/apache/spark/pull/41723
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] lyy-pineapple commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "lyy-pineapple (via GitHub)" <gi...@apache.org>.
lyy-pineapple commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1617115794
> The issue here is in `TaskSetManager` (tsm), not `ExecutorAllocationManager`. The scenario you laid out is correct, namely:
>
> Initial state:
>
> * For partition P, original task T1 = 1.0 and speculative task T2 = 1.1
> * `speculatableTasks` is empty, since 1.1 has started already.
>
> T1 fails [1]:
>
> * tsm.`handleFailedTask` adds the task again (`addPendingTask` at the end).
> * This in turn adds P to all the task lists
>
> Assuming [1] has not yet been scheduled [1] and we have `checkSpeculatableTasks` invoked, we will have:
>
> The condition in `checkAndSubmitSpeculatableTasks` will be true, namely : `!successful(index) && copiesRunning(index) == 1 && !speculatableTasks.contains(index)` Hence we add a speculative task for schedule. Now we actually have the running speculative task, the re-added failed task replacement, and yet another speculative task added. This is the reason why we have 3 pending tasks.
>
> So what is incorrect is addition of the second speculative task itself. The fix would be to change the condition in `checkAndSubmitSpeculatableTasks` to something like:
>
> ```
> !successful(index) && copiesRunning(index) == 1 && !speculatableTasks.contains(index) &&
> // make sure the currently running copy is not a speculative task
> !info.speculative
> ```
>
> +CC @Ngone51 as well, since this is a bit more involved change (though a 1 line change :-) )
>
> [1] If scheduled, copiesRunning > 1, so no speculative task will be scheduled again in `checkAndSubmitSpeculatableTasks`
if add condition ` !info.speculative` ,the speculative task would not be speculated.I thought there may be some issues with this
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] mridulm commented on pull request #41723: [SPARK-44179][CORE]Fix the number of executors is calculated incorrctly when the task fails and it is speculated that the task is still executing
Posted by "mridulm (via GitHub)" <gi...@apache.org>.
mridulm commented on PR #41723:
URL: https://github.com/apache/spark/pull/41723#issuecomment-1614267565
Thanks for contributing this patch @lyy-pineapple, I will take a look at it later tomorrow.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org