[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:
parent
23f93f559c
commit
dd11e401e4
|
@ -571,6 +571,11 @@ private[spark] class TaskSchedulerImpl(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
while (!backend.isReady) {
|
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 {
|
synchronized {
|
||||||
this.wait(100)
|
this.wait(100)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue