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 2019/05/31 02:38:03 UTC

[GitHub] [spark] jiangxb1987 commented on a change in pull request #24699: [SPARK-27666][CORE] Do not release lock while TaskContext already completed

jiangxb1987 commented on a change in pull request #24699: [SPARK-27666][CORE] Do not release lock while TaskContext already completed
URL: https://github.com/apache/spark/pull/24699#discussion_r289240145
 
 

 ##########
 File path: core/src/test/scala/org/apache/spark/rdd/RDDSuite.scala
 ##########
 @@ -1176,6 +1176,24 @@ class RDDSuite extends SparkFunSuite with SharedSparkContext {
     }.collect()
   }
 
+  test("SPARK-27666: Do not release lock while TaskContext already completed") {
+    val rdd = sc.parallelize(Range(0, 10), 1).cache()
+    // validate cache
+    rdd.collect()
+    rdd.mapPartitions { iter =>
+      val t = new Thread(() => {
+        while (iter.hasNext) {
+          iter.next()
+          Thread.sleep(100)
+        }
+      })
+      t.setDaemon(false)
+      t.start()
+      Iterator(0)
+    }.collect()
+    Thread.sleep(10 * 150)
 
 Review comment:
   Why not add a TaskCompletionListener and wait for the listener to be triggered? Something like:
   ```
         eventually(timeout(10.seconds)) {
             assert(// Task completion triggered.)
         }
   ```

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

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