Skip to content
Snippets Groups Projects
Commit e164a04b authored by Shixiong Zhu's avatar Shixiong Zhu Committed by Tathagata Das
Browse files

[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 <shixiong@databricks.com>

Closes #14354 from zsxwing/ssc-leak.
parent db36e1e7
No related branches found
No related tags found
No related merge requests found
......@@ -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
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment