dongjoon-hyun commented on a change in pull request #25808: 
[SPARK-29104][CORE][TESTS] Fix PipedRDDSuite to use `eventually` to check 
thread termination
URL: https://github.com/apache/spark/pull/25808#discussion_r325012615
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/rdd/PipedRDDSuite.scala
 ##########
 @@ -100,11 +102,16 @@ class PipedRDDSuite extends SparkFunSuite with 
SharedSparkContext {
 
     assert(result.collect().length === 0)
 
-    // collect stderr writer threads
-    val stderrWriterThread = Thread.getAllStackTraces.keySet().asScala
-      .find { _.getName.startsWith(PipedRDD.STDIN_WRITER_THREAD_PREFIX) }
-
-    assert(stderrWriterThread.isEmpty)
+    // SPARK-29104 PipedRDD will invoke `stdinWriterThread.interrupt()` at 
task completion,
+    // and `obj.wait` will get InterruptedException. However, there exists a 
possibility
 
 Review comment:
   The second flow is correct. However, the first one is slightly differently 
described. `stdinWriterThread` is not catching the exception. The task thread 
is just marked as `interrupted` status and restarts from the after `obj.wait` 
bytecode with `InterruptedException`. However, this `Task` thread can be slow 
and the test code grabs the `Thread.getAllStackTraces` before the `Task` thread 
escaped from the run function.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to