This is an automated email from the ASF dual-hosted git repository.

nicholasjiang pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/celeborn.git


The following commit(s) were added to refs/heads/branch-0.6 by this push:
     new d4ef10986 [CELEBORN-2294] The shuffle fetch failed report from the 
zombie stage should be ignored
d4ef10986 is described below

commit d4ef109868a841ce171bea0f93afe34870a3ed0f
Author: Xianming Lei <[email protected]>
AuthorDate: Thu Apr 2 10:52:28 2026 +0800

    [CELEBORN-2294] The shuffle fetch failed report from the zombie stage 
should be ignored
    
    ### What changes were proposed in this pull request?
    The shuffle fetch failed report from the zombie stage should be ignored
    
    ### Why are the changes needed?
    Without this PR, if a stage attempt has already triggered FetchFailed, 
there will still be running tasks reporting fetch failed to LifeCycleManager, 
which will cause the current Stage Attempt to mistakenly trigger a stage rerun.
    
    Spark also ignores FetchFailed from the previous stage attempt, and 
Celeborn should keep the same logic.
    <img width="1760" height="664" alt="image" 
src="https://github.com/user-attachments/assets/201cd849-475b-442f-bec1-0b8ef1048036";
 />
    
    ### Does this PR resolve a correctness bug?
    No.
    
    ### Does this PR introduce _any_ user-facing change?
    No.
    
    ### How was this patch tested?
    Existing UTs.
    
    Closes #3640 from leixm/main.
    
    Authored-by: Xianming Lei <[email protected]>
    Signed-off-by: SteNicholas <[email protected]>
    (cherry picked from commit 097f1df172e7ed8f2d32c3c5a8c04b22a595fe25)
    Signed-off-by: SteNicholas <[email protected]>
---
 .../apache/spark/shuffle/celeborn/SparkUtils.java  |  9 ++++
 .../apache/spark/shuffle/celeborn/SparkUtils.java  |  9 ++++
 .../spark/shuffle/celeborn/SparkUtilsSuite.scala   | 57 +++++++++++++++++++++-
 3 files changed, 74 insertions(+), 1 deletion(-)

diff --git 
a/client-spark/spark-2/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
 
b/client-spark/spark-2/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
index a3ec12a1e..d04f4b0eb 100644
--- 
a/client-spark/spark-2/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
+++ 
b/client-spark/spark-2/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
@@ -323,6 +323,15 @@ public class SparkUtils {
         int stageId = taskSetManager.stageId();
         int stageAttemptId = taskSetManager.taskSet().stageAttemptId();
         int maxTaskFails = taskSetManager.maxTaskFailures();
+        if (taskSetManager.isZombie()) {
+          logger.info(
+              "StageId={} stageAttemptId={} taskId={}: TaskSetManager is 
zombie, skip reporting "
+                  + "shuffle fetch failure to avoid invalidating active 
shuffle data.",
+              stageId,
+              stageAttemptId,
+              taskId);
+          return false;
+        }
         String stageUniqId = stageId + "-" + stageAttemptId;
         Set<Long> reportedStageTaskIds =
             reportedStageShuffleFetchFailureTaskIds.computeIfAbsent(
diff --git 
a/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
 
b/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
index fabc098f3..cb7d39011 100644
--- 
a/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
+++ 
b/client-spark/spark-3/src/main/java/org/apache/spark/shuffle/celeborn/SparkUtils.java
@@ -451,6 +451,15 @@ public class SparkUtils {
         int stageId = taskSetManager.stageId();
         int stageAttemptId = taskSetManager.taskSet().stageAttemptId();
         int maxTaskFails = taskSetManager.maxTaskFailures();
+        if (taskSetManager.isZombie()) {
+          LOG.info(
+              "StageId={} stageAttemptId={} taskId={}: TaskSetManager is 
zombie, skip reporting "
+                  + "shuffle fetch failure to avoid invalidating active 
shuffle data.",
+              stageId,
+              stageAttemptId,
+              taskId);
+          return false;
+        }
         String stageUniqId = stageId + "-" + stageAttemptId;
         Set<Long> reportedStageTaskIds =
             reportedStageShuffleFetchFailureTaskIds.computeIfAbsent(
diff --git 
a/tests/spark-it/src/test/scala/org/apache/spark/shuffle/celeborn/SparkUtilsSuite.scala
 
b/tests/spark-it/src/test/scala/org/apache/spark/shuffle/celeborn/SparkUtilsSuite.scala
index 359b73c52..85a1d815f 100644
--- 
a/tests/spark-it/src/test/scala/org/apache/spark/shuffle/celeborn/SparkUtilsSuite.scala
+++ 
b/tests/spark-it/src/test/scala/org/apache/spark/shuffle/celeborn/SparkUtilsSuite.scala
@@ -20,7 +20,7 @@ package org.apache.spark.shuffle.celeborn
 import scala.collection.JavaConverters._
 
 import org.apache.spark.SparkConf
-import org.apache.spark.scheduler.TaskSchedulerImpl
+import org.apache.spark.scheduler.{TaskSchedulerImpl, TaskSetManager}
 import org.apache.spark.sql.SparkSession
 import org.scalatest.BeforeAndAfterEach
 import org.scalatest.concurrent.Eventually.eventually
@@ -161,6 +161,61 @@ class SparkUtilsSuite extends AnyFunSuite
     }
   }
 
+  test("shouldReportShuffleFetchFailure returns false when TaskSetManager is 
zombie") {
+    val sparkConf = new 
SparkConf().setAppName("rss-demo").setMaster("local[2,3]")
+    val sparkSession = SparkSession.builder()
+      .config(updateSparkConf(sparkConf, ShuffleMode.HASH))
+      .config("spark.sql.shuffle.partitions", 2)
+      .config("spark.celeborn.shuffle.forceFallback.partition.enabled", false)
+      .config("spark.celeborn.client.spark.stageRerun.enabled", "true")
+      .config(
+        "spark.shuffle.manager",
+        "org.apache.spark.shuffle.celeborn.TestCelebornShuffleManager")
+      .getOrCreate()
+
+    try {
+      val sc = sparkSession.sparkContext
+      val jobThread = new Thread {
+        override def run(): Unit = {
+          try {
+            sc.parallelize(1 to 100, 2)
+              .repartition(1)
+              .mapPartitions { iter =>
+                Thread.sleep(10000)
+                iter
+              }.collect()
+          } catch {
+            case _: InterruptedException =>
+          }
+        }
+      }
+      jobThread.start()
+
+      val taskScheduler = sc.taskScheduler.asInstanceOf[TaskSchedulerImpl]
+      eventually(timeout(3.seconds), interval(100.milliseconds)) {
+        val taskId: Long = 0
+        val taskSetManager = SparkUtils.getTaskSetManager(taskScheduler, 
taskId)
+        assert(taskSetManager != null)
+
+        val isZombieField = 
classOf[TaskSetManager].getDeclaredField("isZombie")
+        isZombieField.setAccessible(true)
+        isZombieField.setBoolean(taskSetManager, true)
+
+        SparkUtils.reportedStageShuffleFetchFailureTaskIds.clear()
+        SparkUtils.lastReportedShuffleFetchFailureTaskId = null
+
+        assert(!SparkUtils.shouldReportShuffleFetchFailure(taskId))
+        assert(SparkUtils.reportedStageShuffleFetchFailureTaskIds.isEmpty)
+        assert(SparkUtils.lastReportedShuffleFetchFailureTaskId == null)
+      }
+
+      sparkSession.sparkContext.cancelAllJobs()
+      jobThread.interrupt()
+    } finally {
+      sparkSession.stop()
+    }
+  }
+
   test("serialize/deserialize GetReducerFileGroupResponse with broadcast") {
     val sparkConf = new 
SparkConf().setAppName("rss-demo").setMaster("local[2,3]")
     val sparkSession = SparkSession.builder()

Reply via email to