You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/11/11 06:02:11 UTC
[GitHub] [spark] mridulm commented on a diff in pull request #38617: [SPARK-40096][CORE][TESTS][FOLLOW-UP] Fix flaky test case
mridulm commented on code in PR #38617:
URL: https://github.com/apache/spark/pull/38617#discussion_r1019859895
##########
core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala:
##########
@@ -4533,16 +4533,20 @@ class DAGSchedulerSuite extends SparkFunSuite with TempLocalSparkContext with Ti
blockStoreClientField.setAccessible(true)
blockStoreClientField.set(sc.env.blockManager, blockStoreClient)
- val sentHosts = ArrayBuffer[String]()
+ val sentHosts = JCollections.synchronizedList(new JArrayList[String]())
var hostAInterrupted = false
doAnswer { (invoke: InvocationOnMock) =>
val host = invoke.getArgument[String](0)
- sendRequestsLatch.countDown()
try {
if (host == "hostA") {
- canSendRequestLatch.await(timeoutSecs * 2, TimeUnit.SECONDS)
+ sendRequestsLatch.countDown()
+ canSendRequestLatch.await(timeoutSecs * 5, TimeUnit.SECONDS)
+ // should not reach here, will get interrupted by DAGScheduler
+ sentHosts.add(host)
+ } else {
+ sentHosts.add(host)
+ sendRequestsLatch.countDown()
Review Comment:
Do countdown after adding to sentHosts - to prevent race
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org