LuciferYang commented on code in PR #40663:
URL: https://github.com/apache/spark/pull/40663#discussion_r1159661075


##########
core/src/test/scala/org/apache/spark/executor/ExecutorSuite.scala:
##########
@@ -270,6 +271,29 @@ class ExecutorSuite extends SparkFunSuite
     heartbeatZeroAccumulatorUpdateTest(false)
   }
 
+  test("SPARK-39696: Using accumulators should not cause heartbeat to fail") {
+    val conf = new SparkConf().setMaster("local").setAppName("executor suite 
test")
+    conf.set(EXECUTOR_HEARTBEAT_INTERVAL.key, "1ms")
+    sc = new SparkContext(conf)
+
+    val accums = (1 to 10).map(i => 
sc.longAccumulator(s"mapperRunAccumulator$i"))
+    val input = sc.parallelize(1 to 10, 10)
+    var testRdd = input.map(i => (i, i))
+    (0 to 10).foreach( i =>
+        testRdd = testRdd
+          .map(x => { accums.foreach(_.add(1)); (x._1 * i, x._2) })
+          .reduceByKey(_ + _)
+    )
+
+    val logAppender = new LogAppender(s"heartbeat thread should not die")
+    withLogAppender(logAppender, level = Some(Level.ERROR)) {
+      val _ = testRdd.count()
+    }
+    val logs = logAppender.loggingEvents.map(_.getMessage.getFormattedMessage)
+        .filter(_.contains("Uncaught exception in thread 
executor-heartbeater"))

Review Comment:
   indent: 2 spaces



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to