[SPARK-14537][CORE] Make TaskSchedulerImpl waiting fail if context is shut down

This patch makes the postStartHook throw an IllegalStateException if the SparkContext is shutdown while it is waiting for the backend to be ready

Author: Charles Allen <charles@allen-net.com>

Closes #12301 from drcrallen/SPARK-14537.
This commit is contained in:
Charles Allen 2016-04-13 16:02:49 +01:00 committed by Sean Owen
parent 23f93f559c
commit dd11e401e4

View file

@ -571,6 +571,11 @@ private[spark] class TaskSchedulerImpl(
return
}
while (!backend.isReady) {
// Might take a while for backend to be ready if it is waiting on resources.
if (sc.stopped.get) {
// For example: the master removes the application for some reason
throw new IllegalStateException("Spark context stopped while waiting for backend")
}
synchronized {
this.wait(100)
}