You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by xuanyuanking <gi...@git.apache.org> on 2018/03/29 04:53:26 UTC

[GitHub] spark pull request #20930: [SPARK-23811][Core] Same tasks' FetchFailed event...

GitHub user xuanyuanking opened a pull request:

    https://github.com/apache/spark/pull/20930

    [SPARK-23811][Core] Same tasks' FetchFailed event comes before Success will cause child stage never succeed

    ## What changes were proposed in this pull request?
    
    This is a bug caused by abnormal scenario describe below:
    
    ShuffleMapTask 1.0 running, this task will fetch data from ExecutorA
    ExecutorA Lost, trigger `mapOutputTracker.removeOutputsOnExecutor(execId)` , shuffleStatus changed.
    Speculative ShuffleMapTask 1.1 start, got a FetchFailed immediately.
    ShuffleMapTask 1 is the last task of its stage, so this stage will never succeed because of there's no missing task DAGScheduler can get.
    
    I apply the detailed screenshots in jira comments.
    
    ## How was this patch tested?
    
    Add a new UT in `TaskSetManagerSuite`


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/xuanyuanking/spark SPARK-23811

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/20930.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #20930
    
----
commit 2907075b43eac26c7efbe4aca5f2c037bb5934c2
Author: Yuanjian Li <xy...@...>
Date:   2018-03-29T04:50:16Z

    [SPARK-23811][Core] Same tasks' FetchFailed event comes before Success will cause child stage never succeed

----


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r181732788
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    +      logInfo("Ignoring task-finished event for " + info.id + " in stage " + taskSet.id +
    +        " because task " + index + " has already failed by FetchFailed")
    +      return
    --- End diff --
    
    Maybe, we can mark task as`FAILED` with `UnknownReason` here. And then, DAG will treat this task as no-op, and `registerMapOutput` will not be triggered. Though, it is not a elegant way.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89479 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89479/testReport)** for PR 20930 at commit [`ba6f71a`](https://github.com/apache/spark/commit/ba6f71a0fc49ce2a07addec3496177c4b2b43fef).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182294068
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    --- End diff --
    
    Great thanks for you two's guidance guidance, that's more clear and the UT add for reproducing this problem can also used for checking it!


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89870 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89870/testReport)** for PR 20930 at commit [`fee903c`](https://github.com/apache/spark/commit/fee903c65c59219cdc1c0937ac8be4777142ffbd).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r181776729
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    --- End diff --
    
    We should handle this case in DAGScheduler, then we can look up the stage by task id, and see if the stage is failed or not. Then we don't need `fetchFailedTaskIndexSet`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89870/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88697/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    @Ngone51 Thanks for your review.
    > Does stage 2 is correspond to the never success stage in PR description ?
    
    Stage 3 is the never success stage, stage 2 is its parent stage.
    
    > So, why stage 2 retry 4 times when there's no more missing tasks?
    
    Stage 2 retry 4 times triggered by Stage 3's fetch failed event. Actually in this scenario, stage 3 will always failed by fetch fail.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #88697 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88697/testReport)** for PR 20930 at commit [`2907075`](https://github.com/apache/spark/commit/2907075b43eac26c7efbe4aca5f2c037bb5934c2).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    The scenario can be reproduced by below test case added in `DAGSchedulerSuite`
    ```scala
    /**
       * This tests the case where origin task success after speculative task got FetchFailed
       * before.
       */
      test("[SPARK-23811] Fetch failed task should kill other attempt") {
        // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
        val rddA = new MyRDD(sc, 2, Nil)
        val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
        val shuffleIdA = shuffleDepA.shuffleId
    
        val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
        val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    
        val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    
        submit(rddC, Array(0, 1))
    
        // Complete both tasks in rddA.
        assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
        complete(taskSets(0), Seq(
          (Success, makeMapStatus("hostA", 2)),
          (Success, makeMapStatus("hostB", 2))))
    
        // The first task success
        runEvent(makeCompletionEvent(
          taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    
        // The second task's speculative attempt fails first, but task self still running.
        // This may caused by ExecutorLost.
        runEvent(makeCompletionEvent(
          taskSets(1).tasks(1),
          FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
          null))
        // Check currently missing partition
        assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
        val missingPartition = mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get(0)
    
        // The second result task self success soon
        runEvent(makeCompletionEvent(
          taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
        // No missing partitions here, this will cause child stage never succeed
        assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 0)
      }
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2676/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    cc @jerryshao  @cloud-fan 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184255020
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    --- End diff --
    
    where is the code in `DAGScheduler` we ignore this task?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184266100
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    --- End diff --
    
    and it seems Spark will wrongly isssue a job end event, can you check it in the test?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2411/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r178470893
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -794,6 +794,19 @@ private[spark] class TaskSetManager(
                 fetchFailed.bmAddress.host, fetchFailed.bmAddress.executorId))
             }
     
    +        // Kill any other attempts for this FetchFailed task
    +        for (attemptInfo <- taskAttempts(index) if attemptInfo.running) {
    +          logInfo(s"Killing attempt ${attemptInfo.attemptNumber} for task ${attemptInfo.id} " +
    +            s"in stage ${taskSet.id} (TID ${attemptInfo.taskId}) on ${attemptInfo.host} " +
    +            s"as the attempt ${info.attemptNumber} failed because FetchFailed")
    +          killedByOtherAttempt(index) = true
    +          sched.backend.killTask(
    --- End diff --
    
    if this is async, we can't guarantee to not have task success events after marking staging as failed, right?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r178494006
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -794,6 +794,19 @@ private[spark] class TaskSetManager(
                 fetchFailed.bmAddress.host, fetchFailed.bmAddress.executorId))
             }
     
    +        // Kill any other attempts for this FetchFailed task
    +        for (attemptInfo <- taskAttempts(index) if attemptInfo.running) {
    +          logInfo(s"Killing attempt ${attemptInfo.attemptNumber} for task ${attemptInfo.id} " +
    +            s"in stage ${taskSet.id} (TID ${attemptInfo.taskId}) on ${attemptInfo.host} " +
    +            s"as the attempt ${info.attemptNumber} failed because FetchFailed")
    +          killedByOtherAttempt(index) = true
    +          sched.backend.killTask(
    --- End diff --
    
    This should not work. Maybe we shall just ignore the finished tasks submitted to a failed stage?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    @cloud-fan @jiangxb1987 
    Sorry for late reply, delete the useless code as our discussion before. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    @Ngone51 
    You can check the screenshot in detail, stage 2's shuffleID is 1, but stage 3 failed by missing an output for shuffle '0'! So here the stage 2's skip cause stage 3 got an error shuffleId, the root case is this patch wants to fix, missing task should have, but actually not. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Hi, @xuanyuanking , I'm still confused (smile & cry). 
    > Stage 2 retry 4 times triggered by Stage 3's fetch failed event. Actually in this scenario, stage 3 will always failed by fetch fail.
    
    Stage 2 has no missing tasks, right? So,  there's no missing partitions for Stage 2 (which means Stage 3 can always get Stage 2's MapOutputs from `MapOutputTrackerMaster` ), right? So, why  Stage 3 will always failed by FetchFail?
     
    Hope you can explain more. Thank you very much!



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184109204
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    Added the UT for simulating this scenario happens to result task.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Yeah, the stage resubmitted, but there's no missing task for this stage and actually no task will be resubmitted. This mainly because the `ShuffleMapTask 1.0` triggered `shuffleStage.addOutputLoc`.
    The screenshot I attached in Jira maybe help to explain this scenario.
    ![image](https://user-images.githubusercontent.com/4833765/38135625-c54309f2-344b-11e8-850e-9f99dc2b28a0.png)
    ![image](https://user-images.githubusercontent.com/4833765/38135635-d17360aa-344b-11e8-8328-a386c22f966a.png)
    You can see the empty ShuffleMapStage 2 retry 4 times, finally its child stage 3 failed with FetchFailed.



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #88806 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88806/testReport)** for PR 20930 at commit [`08f6930`](https://github.com/apache/spark/commit/08f693017b01935eb2ae4f785ddb0cf9f9142125).
     * This patch **fails Spark unit tests**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r178499952
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -794,6 +794,19 @@ private[spark] class TaskSetManager(
                 fetchFailed.bmAddress.host, fetchFailed.bmAddress.executorId))
             }
     
    +        // Kill any other attempts for this FetchFailed task
    +        for (attemptInfo <- taskAttempts(index) if attemptInfo.running) {
    +          logInfo(s"Killing attempt ${attemptInfo.attemptNumber} for task ${attemptInfo.id} " +
    +            s"in stage ${taskSet.id} (TID ${attemptInfo.taskId}) on ${attemptInfo.host} " +
    +            s"as the attempt ${info.attemptNumber} failed because FetchFailed")
    +          killedByOtherAttempt(index) = true
    +          sched.backend.killTask(
    --- End diff --
    
    @cloud-fan  Yes you're right, I should guarantee this in TaskSetManager.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r181729645
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    +      logInfo("Ignoring task-finished event for " + info.id + " in stage " + taskSet.id +
    +        " because task " + index + " has already failed by FetchFailed")
    +      return
    --- End diff --
    
    We can not simply `return` here. And we should always send a task `CompletionEvent` to DAG, in case of there's any listeners are waiting for it. 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r181674151
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    --- End diff --
    
    The change of `fetchFailedTaskIndexSet` is to ignore the task success event if the stage is marked as failed, as Wenchen's suggestion in before comment.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184265979
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    --- End diff --
    
    > INFO DAGScheduler: ResultStage 1 () finished in 0.136 s
    
    This is unexpected, isn't it?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89389 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89389/testReport)** for PR 20930 at commit [`0defc09`](https://github.com/apache/spark/commit/0defc09dbcbd0b227eab583d0426b5dc78232b37).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    > Have you applied this patch: #17955 ?
    
    No, this happened on Spark 2.1. Thanks xingbo & wenchen, I'll port back this patch to our internal Spark 2.1.
    
    > That PR seems to be addressing the issue you described:
    
    Yeah, the description is similar with currently scenario, but there's also a puzzle about the wrong ShuffleId, I'm trying to find the reason. Thanks again for your help, I'll first port back this patch.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88690/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    ![image](https://user-images.githubusercontent.com/4833765/39091106-ff11d0a6-461f-11e8-968f-7fcbe6652bb3.png)
    
    Stage 0\1\2\3 same with 20\21\22\23 in this screenshot, stage2's shuffleId is 1 but stage3's is 0 can't happen.
    
    Good description for the scenario, can't get a FetchFailed because we can get the MapStatus, but get a 'null'. If I'm not mistaken, this also because the ExecutorLost trigger `removeOutputsOnExecutor`.
    
    Happy to discuss with all guys and sorry for can't giving more detailed log after checking the root case, this happened in Baidu online env and can't keep all logs for 1 month. I'll keep fixing the case and catching details log as mush as possible.
    



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1895/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89479 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89479/testReport)** for PR 20930 at commit [`ba6f71a`](https://github.com/apache/spark/commit/ba6f71a0fc49ce2a07addec3496177c4b2b43fef).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Hi, @xuanyuanking , thank for your patient explanation, sincerely.
    
    With regard to your latest explanation:
     
    > stage 2's shuffleID is 1, but stage 3 failed by missing an output for shuffle '0'! So here the stage 2's skip cause stage 3 got an error shuffleId.
    
    However, I don't think stage 2's skip will lead to stage 3 got an error shuffleId, as we've already created all `ShuffleDependencies ` (constructed with certain ids) for `ShuffleMapStages` before any stages of a job submitted. 
    
    As I struggle for understanding this issue for a while,  finally, I got my own inference:
    
    (assume the 2 ShuffleMapTasks below is belong to stage 2, and stage 2 has two partitions on map side. And stage 2 has a parent stage named stage 1, and a child stage named stage 3.)
    
    1. ShuffleMapTask 0.0 run on ExecutorB,  and write map output on ExecutorB,  succeed normally.
    And now, there's only '1' available map output registered on `MapOutputTrackerMaster `.
    
    2. ShuffleMapTask 1.0 is running on ExecutorA, and fetch data from ExecutorA, and write map output on ExecutorA, too.
    
    3. ExecutorA lost for unknown reason after send `StatusUpdate` message to driver, which tells ShuffleMapTask 1.0's success. And all map outputs on ExecutorA lost, include ShuffleMapTask 1.0's map output.
    
    4. And driver launch a speculative ShuffleMapTask 1.1 before it receives the `StatusUpdate` message. And ShuffleMapTask 1.1 get FetchFailed immediately.
    
    5. `DAGScheduler` handle the FetchFailed ShuffleMapTask 1.1 firstly, mark stage 2 and it's parent stage 1 as failed. And stage 1 & stage 2 are waiting for resubmit.
    
    6. `DAGScheduler ` handle the success ShuffleMapTask 1.0 before stage 1 & stage 2 resubmit, which trigger `MapOutputTrackerMaster.registerMapOutput` . And now, there's '2' available map output registered on `MapOutputTrackerMaster ` (but knowing ShuffleMapTask 1.0's map output on ExecutorA has been lost.).
    
    7. stage 1 resubmitted and succeed normally.
    
    8. stage 2 resubmitted. As stage 2 has '2' available map output registered on `MapOutputTrackerMaster `, so there's no missing partitions for stage 2. Thus, stage 2 has no missing tasks to submit, too. 
    
    9. And then, we submit stage 3. As stage 2's map output file lost on ExecutorA, so stage 3 must get a FetchFailed at the end. Then, we resubmit stage 2& stage 3.  And then we get into a loop until stag 3 abort.
    
    But if the issue is what I described above, we should get `FetchFailedException` instead of `MetadataFetchFailedException`  shown in screenshot.  So, at this point which can not make sense. 
    
    Please feel free to point my wrong spot out.
    
    Anyway, thanks again.



---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89870 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89870/testReport)** for PR 20930 at commit [`fee903c`](https://github.com/apache/spark/commit/fee903c65c59219cdc1c0937ac8be4777142ffbd).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r178537775
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -794,6 +794,19 @@ private[spark] class TaskSetManager(
                 fetchFailed.bmAddress.host, fetchFailed.bmAddress.executorId))
             }
     
    +        // Kill any other attempts for this FetchFailed task
    +        for (attemptInfo <- taskAttempts(index) if attemptInfo.running) {
    +          logInfo(s"Killing attempt ${attemptInfo.attemptNumber} for task ${attemptInfo.id} " +
    +            s"in stage ${taskSet.id} (TID ${attemptInfo.taskId}) on ${attemptInfo.host} " +
    +            s"as the attempt ${info.attemptNumber} failed because FetchFailed")
    +          killedByOtherAttempt(index) = true
    +          sched.backend.killTask(
    --- End diff --
    
    I don't think so. Useless tasks should fail soon(FetchFailure usually means mapper is down).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    No wonder I can't understand the issue for a long time since I've thought it happened on Spark2.3 . And now it makes sense. Thanks @jiangxb1987 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2339/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2410/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #88697 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88697/testReport)** for PR 20930 at commit [`2907075`](https://github.com/apache/spark/commit/2907075b43eac26c7efbe4aca5f2c037bb5934c2).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    retest this please


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2686/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184254856
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    assertDataStructuresEmpty()
    --- End diff --
    
    what does this test?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89849/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182307786
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,50 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("[SPARK-23811] FetchFailed comes before Success of same task will cause child stage" +
    +    " never succeed") {
    --- End diff --
    
    Thanks, I'll change it.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    @Ngone51 Ah, maybe I know how the description misleading you, the in the description 5, 'this stage' refers to 'Stage 2' in screenshot, thanks for your check, I modified the description to avoid misleading others.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182307728
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,50 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("[SPARK-23811] FetchFailed comes before Success of same task will cause child stage" +
    +    " never succeed") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    --- End diff --
    
    Here we only need to mock the speculative task failed event came before success event, `makeCompletionEvent` with same taskSets's task can achieve such goal. This also use in `task events always posted in speculation / when stage is killed`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r181673508
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -794,6 +794,19 @@ private[spark] class TaskSetManager(
                 fetchFailed.bmAddress.host, fetchFailed.bmAddress.executorId))
             }
     
    +        // Kill any other attempts for this FetchFailed task
    +        for (attemptInfo <- taskAttempts(index) if attemptInfo.running) {
    +          logInfo(s"Killing attempt ${attemptInfo.attemptNumber} for task ${attemptInfo.id} " +
    +            s"in stage ${taskSet.id} (TID ${attemptInfo.taskId}) on ${attemptInfo.host} " +
    +            s"as the attempt ${info.attemptNumber} failed because FetchFailed")
    +          killedByOtherAttempt(index) = true
    +          sched.backend.killTask(
    --- End diff --
    
    Got it, I remove the code and UT in next commit.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182308871
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,50 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("[SPARK-23811] FetchFailed comes before Success of same task will cause child stage" +
    +    " never succeed") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    --- End diff --
    
    Maybe, you can `runEvent(SpeculativeTaskSubmitted)` first to simulate a speculative task submitted before you `runEvent(makeCompletetionEvent())`.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184260815
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    assertDataStructuresEmpty()
    --- End diff --
    
    I mean the last line, `assertDataStructuresEmpty`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89849 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89849/testReport)** for PR 20930 at commit [`a201764`](https://github.com/apache/spark/commit/a201764c94b21e294f0a32cb71019b422e8d8090).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89850 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89850/testReport)** for PR 20930 at commit [`7f8503f`](https://github.com/apache/spark/commit/7f8503f7f921568a09b967ddf75f2ce2f027e197).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    > What's your proposed fix?
    I fix this by killing other attempts while receive a FetchFailed in `TaskSetManager`. If we finally ignore the success event of other attempts, might as well stop the task.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1828/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    What happened to `ShuffleMapTask 1.0` exactly? There are 2 cases: the stage is marked as failed, but not be resubmitted yet, or the stage has been resubmitted, or the stage is aborted.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r178500184
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -794,6 +794,19 @@ private[spark] class TaskSetManager(
                 fetchFailed.bmAddress.host, fetchFailed.bmAddress.executorId))
             }
     
    +        // Kill any other attempts for this FetchFailed task
    +        for (attemptInfo <- taskAttempts(index) if attemptInfo.running) {
    +          logInfo(s"Killing attempt ${attemptInfo.attemptNumber} for task ${attemptInfo.id} " +
    +            s"in stage ${taskSet.id} (TID ${attemptInfo.taskId}) on ${attemptInfo.host} " +
    +            s"as the attempt ${info.attemptNumber} failed because FetchFailed")
    +          killedByOtherAttempt(index) = true
    +          sched.backend.killTask(
    --- End diff --
    
    @jiangxb1987 Yes, ignore the finished event is necessary, maybe it's also needed to kill useless task?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    then why is it a problem? The stage should be resubmitted soon, `ShuffleMapTask 1.0` should be a no-op.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182299803
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,50 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("[SPARK-23811] FetchFailed comes before Success of same task will cause child stage" +
    +    " never succeed") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    --- End diff --
    
    Sorry I'm not very familiar with this test suite, how can you tell it's a speculative task?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test FAILed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/88806/
    Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test FAILed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by markhamstra <gi...@git.apache.org>.
Github user markhamstra commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184462542
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    assertDataStructuresEmpty()
    --- End diff --
    
    Right. It is a check that we are cleaning up the contents of the DAGScheduler's data structures so that they do not grow without bound over time.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Have you applied this patch: https://github.com/apache/spark/pull/17955 ?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182309137
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    This also confuse me before, as far as I'm concerned, the result task in such scenario(speculative task fail but original task success) is ok because it has no child stage, we can use the success task's result and `markStageAsFinished`. But for shuffle map task, it will cause inconformity between mapOutputTracker and stage's pendingPartitions, it must fix.
    I'm not sure of ResultTask's behavior, can you give some advice?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182296297
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    +      logInfo("Ignoring task-finished event for " + info.id + " in stage " + taskSet.id +
    +        " because task " + index + " has already failed by FetchFailed")
    +      return
    --- End diff --
    
    Yep, as @cloud-fan 's suggestion, handle this in `DAGScheduler` is a better choice.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184276403
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    --- End diff --
    
    Yep, you're right. The success completely event in UT was treated as normal success task. I fixed this by ignore this event at the beginning of handleTaskCompletion.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89389 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89389/testReport)** for PR 20930 at commit [`0defc09`](https://github.com/apache/spark/commit/0defc09dbcbd0b227eab583d0426b5dc78232b37).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182299503
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,50 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("[SPARK-23811] FetchFailed comes before Success of same task will cause child stage" +
    +    " never succeed") {
    --- End diff --
    
    nit: the test name should describe the expected behavior not the wrong one.
    `SPARK-23811: staged failed by FetchFailed should ignore following successful tasks`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182336811
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    ResultStage usually has children. e.g. rdd1 depends on rdd2 with a shuffle dependency. Then the job has 2 stages, the result stage depends on the shuffle map stage.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/1820/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    what happened to `ShuffleMapTask 1.0`? I don't get it from your PR description.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182338127
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    Sorry I may nitpick kere. Can you simulate what happens to result task if FechFaileded comes before task success?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    What's your proposed fix? it sounds like we can just ignore `ShuffleMapTask 1.0` if the stage is marked as failed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/testing-k8s-prb-make-spark-distribution/2675/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #88690 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88690/testReport)** for PR 20930 at commit [`2907075`](https://github.com/apache/spark/commit/2907075b43eac26c7efbe4aca5f2c037bb5934c2).
     * This patch **fails due to an unknown error code, -9**.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184260210
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    assertDataStructuresEmpty()
    --- End diff --
    
    I add this test for answering your previous question "Can you simulate what happens to result task if FechFaileded comes before task success?". This test can pass without my code changing in DAGScheduler.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184260597
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    --- End diff --
    
    The success task will be ignored by `OutputCommitCoordinator.taskCompleted`, in the taskCompleted logic, stageStates.getOrElse will return because the current stage is in failed set. The detailed log providing below:
    ```
    18/04/26 10:50:24.524 ScalaTest-run-running-DAGSchedulerSuite INFO DAGScheduler: Resubmitting ShuffleMapStage 0 (RDD at DAGSchedulerSuite.scala:74) and ResultStage 1 () due to fetch failure
    18/04/26 10:50:24.535 ScalaTest-run-running-DAGSchedulerSuite DEBUG DAGSchedulerSuite$$anon$6: Increasing epoch to 2
    18/04/26 10:50:24.538 ScalaTest-run-running-DAGSchedulerSuite INFO DAGScheduler: Executor lost: exec-hostA (epoch 1)
    18/04/26 10:50:24.540 ScalaTest-run-running-DAGSchedulerSuite INFO DAGScheduler: Shuffle files lost for executor: exec-hostA (epoch 1)
    18/04/26 10:50:24.545 ScalaTest-run-running-DAGSchedulerSuite DEBUG DAGSchedulerSuite$$anon$6: Increasing epoch to 3
    18/04/26 10:50:24.552 ScalaTest-run-running-DAGSchedulerSuite DEBUG OutputCommitCoordinator: Ignoring task completion for completed stage
    18/04/26 10:50:24.554 ScalaTest-run-running-DAGSchedulerSuite INFO DAGScheduler: ResultStage 1 () finished in 0.136 s
    18/04/26 10:50:24.573 ScalaTest-run-running-DAGSchedulerSuite DEBUG DAGScheduler: Removing stage 1 from failed set.
    18/04/26 10:50:24.575 ScalaTest-run-running-DAGSchedulerSuite DEBUG DAGScheduler: After removal of stage 1, remaining stages = 1
    18/04/26 10:50:24.576 ScalaTest-run-running-DAGSchedulerSuite DEBUG DAGScheduler: Removing stage 0 from failed set.
    18/04/26 10:50:24.576 ScalaTest-run-running-DAGSchedulerSuite DEBUG DAGScheduler: After removal of stage 0, remaining stages = 0
    ```


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r178528414
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/TaskSetManager.scala ---
    @@ -750,6 +752,10 @@ private[spark] class TaskSetManager(
           if (tasksSuccessful == numTasks) {
             isZombie = true
           }
    +    } else if (fetchFailedTaskIndexSet.contains(index)) {
    --- End diff --
    
    Why are you making this change? I don't quite get it.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89479/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    `ShuffleMapTask 1.0` succeed after its speculative task failed by FetchFailed. Thanks for your checking, I will modify the PR description.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182299915
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    Why we only have a problem with shuffle map task not result task?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by cloud-fan <gi...@git.apache.org>.
Github user cloud-fan commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r182340309
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    seems we may mistakenly mark a job as finished?


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89850/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by Ngone51 <gi...@git.apache.org>.
Github user Ngone51 commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    > because we can get the MapStatus, but get a 'null'. If I'm not mistaken, this also because the ExecutorLost trigger removeOutputsOnExecutor
    
    If there's a `null` MapStatus for stage 2, how can it retry 4 times without any tasks? IIUC, `null` MapStatus leads to missing partition, which means there will be some tasks to submit.
    
    As for stage 3's shuffle Id, that's really weird. Hope you can fix it! @xuanyuanking 


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #88806 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88806/testReport)** for PR 20930 at commit [`08f6930`](https://github.com/apache/spark/commit/08f693017b01935eb2ae4f785ddb0cf9f9142125).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Merged build finished. Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/89389/
    Test PASSed.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89850 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89850/testReport)** for PR 20930 at commit [`7f8503f`](https://github.com/apache/spark/commit/7f8503f7f921568a09b967ddf75f2ce2f027e197).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] Same tasks' FetchFailed event comes ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #88690 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/88690/testReport)** for PR 20930 at commit [`2907075`](https://github.com/apache/spark/commit/2907075b43eac26c7efbe4aca5f2c037bb5934c2).


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    The first case, the stage is marked as failed, but not be resubmitted yet.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r183198368
  
    --- Diff: core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala ---
    @@ -1266,6 +1266,9 @@ class DAGScheduler(
                 }
                 if (failedEpoch.contains(execId) && smt.epoch <= failedEpoch(execId)) {
                   logInfo(s"Ignoring possibly bogus $smt completion from executor $execId")
    +            } else if (failedStages.contains(shuffleStage)) {
    --- End diff --
    
    >Sorry I may nitpick here.
    
    No, that's necessary, I should have to make sure about this, thanks for your advice! :)
    
    > Can you simulate what happens to result task if FechFaileded comes before task success?
    
    Sure, but it maybe hardly to reproduce this in real env, I'll try to fake it on UT first ASAP.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark issue #20930: [SPARK-23811][Core] FetchFailed comes before Success of ...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/20930
  
    **[Test build #89849 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/89849/testReport)** for PR 20930 at commit [`a201764`](https://github.com/apache/spark/commit/a201764c94b21e294f0a32cb71019b422e8d8090).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] spark pull request #20930: [SPARK-23811][Core] FetchFailed comes before Succ...

Posted by xuanyuanking <gi...@git.apache.org>.
Github user xuanyuanking commented on a diff in the pull request:

    https://github.com/apache/spark/pull/20930#discussion_r184274946
  
    --- Diff: core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala ---
    @@ -2399,6 +2399,84 @@ class DAGSchedulerSuite extends SparkFunSuite with LocalSparkContext with TimeLi
         }
       }
     
    +  /**
    +   * This tests the case where origin task success after speculative task got FetchFailed
    +   * before.
    +   */
    +  test("SPARK-23811: ShuffleMapStage failed by FetchFailed should ignore following " +
    +    "successful tasks") {
    +    // Create 3 RDDs with shuffle dependencies on each other: rddA <--- rddB <--- rddC
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    val shuffleDepB = new ShuffleDependency(rddB, new HashPartitioner(2))
    +
    +    val rddC = new MyRDD(sc, 2, List(shuffleDepB), tracker = mapOutputTracker)
    +
    +    submit(rddC, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task success
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Check currently missing partition.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +    // The second result task self success soon.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    // Missing partition number should not change, otherwise it will cause child stage
    +    // never succeed.
    +    assert(mapOutputTracker.findMissingPartitions(shuffleDepB.shuffleId).get.size === 1)
    +  }
    +
    +  test("SPARK-23811: check ResultStage failed by FetchFailed can ignore following " +
    +    "successful tasks") {
    +    val rddA = new MyRDD(sc, 2, Nil)
    +    val shuffleDepA = new ShuffleDependency(rddA, new HashPartitioner(2))
    +    val shuffleIdA = shuffleDepA.shuffleId
    +    val rddB = new MyRDD(sc, 2, List(shuffleDepA), tracker = mapOutputTracker)
    +    submit(rddB, Array(0, 1))
    +
    +    // Complete both tasks in rddA.
    +    assert(taskSets(0).stageId === 0 && taskSets(0).stageAttemptId === 0)
    +    complete(taskSets(0), Seq(
    +      (Success, makeMapStatus("hostA", 2)),
    +      (Success, makeMapStatus("hostB", 2))))
    +
    +    // The first task of rddB success
    +    assert(taskSets(1).tasks(0).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(0), Success, makeMapStatus("hostB", 2)))
    +
    +    // The second task's speculative attempt fails first, but task self still running.
    +    // This may caused by ExecutorLost.
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1),
    +      FetchFailed(makeBlockManagerId("hostA"), shuffleIdA, 0, 0, "ignored"),
    +      null))
    +    // Make sure failedStage is not empty now
    +    assert(scheduler.failedStages.nonEmpty)
    +    // The second result task self success soon.
    +    assert(taskSets(1).tasks(1).isInstanceOf[ResultTask[_, _]])
    +    runEvent(makeCompletionEvent(
    +      taskSets(1).tasks(1), Success, makeMapStatus("hostB", 2)))
    +    assertDataStructuresEmpty()
    --- End diff --
    
    Ah, it's used for check job successful complete and all temp structure empty.


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org