GitHub user zsxwing opened a pull request: https://github.com/apache/spark/pull/16627
[SPARK-19267][SS]Fix a race condition when stopping StateStore ## What changes were proposed in this pull request? There is a race condition when stopping StateStore which makes `StateStoreSuite.maintenance` flaky. `StateStore.stop` doesn't wait for the running task to finish, and an out-of-date task may fail `doMaintenance` and cancel the new task. Here is a reproducer: https://github.com/zsxwing/spark/commit/dde1b5b106ba034861cf19e16883cfe181faa6f3 This PR changes `stop` to `stop(blocking: Boolean = true)` to allow the caller waiting until the background thread exits. ## How was this patch tested? Jenkins You can merge this pull request into a Git repository by running: $ git pull https://github.com/zsxwing/spark SPARK-19267 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/spark/pull/16627.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #16627 ---- commit 5fa096c3e11285429100155cdfeb8cc50ef653a8 Author: Shixiong Zhu <shixi...@databricks.com> Date: 2017-01-18T00:30:35Z Fix a race condition when stopping StateStore ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org