From e164a04b2ba3503e5c14cd1cd4beb40e0b79925a Mon Sep 17 00:00:00 2001 From: Shixiong Zhu Date: Mon, 25 Jul 2016 18:26:29 -0700 Subject: [SPARK-16722][TESTS] Fix a StreamingContext leak in StreamingContextSuite when eventually fails ## What changes were proposed in this pull request? This PR moves `ssc.stop()` into `finally` for `StreamingContextSuite.createValidCheckpoint` to avoid leaking a StreamingContext since leaking a StreamingContext will fail a lot of tests and make us hard to find the real failure one. ## How was this patch tested? Jenkins unit tests Author: Shixiong Zhu Closes #14354 from zsxwing/ssc-leak. --- .../scala/org/apache/spark/streaming/StreamingContextSuite.scala | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'streaming/src') diff --git a/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala b/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala index 806e181f61..f1482e5c06 100644 --- a/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala +++ b/streaming/src/test/scala/org/apache/spark/streaming/StreamingContextSuite.scala @@ -819,10 +819,13 @@ class StreamingContextSuite extends SparkFunSuite with BeforeAndAfter with Timeo ssc.checkpoint(checkpointDirectory) ssc.textFileStream(testDirectory).foreachRDD { rdd => rdd.count() } ssc.start() - eventually(timeout(10000 millis)) { - assert(Checkpoint.getCheckpointFiles(checkpointDirectory).size > 1) + try { + eventually(timeout(30000 millis)) { + assert(Checkpoint.getCheckpointFiles(checkpointDirectory).size > 1) + } + } finally { + ssc.stop() } - ssc.stop() checkpointDirectory } -- cgit v1.2.3