diff options
author | Andrew Or <andrew@databricks.com> | 2015-12-21 14:09:04 -0800 |
---|---|---|
committer | Andrew Or <andrew@databricks.com> | 2015-12-21 14:09:04 -0800 |
commit | d655d37ddf59d7fb6db529324ac8044d53b2622a (patch) | |
tree | 13e15fd6c1a641cd1de528222b1805a5f384b475 | |
parent | a820ca19de1fb4daa01939a4b8bde8d874a7f3fc (diff) | |
download | spark-d655d37ddf59d7fb6db529324ac8044d53b2622a.tar.gz spark-d655d37ddf59d7fb6db529324ac8044d53b2622a.tar.bz2 spark-d655d37ddf59d7fb6db529324ac8044d53b2622a.zip |
[SPARK-12466] Fix harmless NPE in tests
```
[info] ReplayListenerSuite:
[info] - Simple replay (58 milliseconds)
java.lang.NullPointerException
at org.apache.spark.deploy.master.Master$$anonfun$asyncRebuildSparkUI$1.applyOrElse(Master.scala:982)
at org.apache.spark.deploy.master.Master$$anonfun$asyncRebuildSparkUI$1.applyOrElse(Master.scala:980)
```
https://amplab.cs.berkeley.edu/jenkins/view/Spark-QA-Test/job/Spark-Master-SBT/4316/AMPLAB_JENKINS_BUILD_PROFILE=hadoop2.2,label=spark-test/consoleFull
This was introduced in #10284. It's harmless because the NPE is caused by a race that occurs mainly in `local-cluster` tests (but don't actually fail the tests).
Tested locally to verify that the NPE is gone.
Author: Andrew Or <andrew@databricks.com>
Closes #10417 from andrewor14/fix-harmless-npe.
-rw-r--r-- | core/src/main/scala/org/apache/spark/deploy/master/Master.scala | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/deploy/master/Master.scala b/core/src/main/scala/org/apache/spark/deploy/master/Master.scala index fc42bf06e4..5d97c63918 100644 --- a/core/src/main/scala/org/apache/spark/deploy/master/Master.scala +++ b/core/src/main/scala/org/apache/spark/deploy/master/Master.scala @@ -979,7 +979,11 @@ private[deploy] class Master( futureUI.onSuccess { case Some(ui) => appIdToUI.put(app.id, ui) - self.send(AttachCompletedRebuildUI(app.id)) + // `self` can be null if we are already in the process of shutting down + // This happens frequently in tests where `local-cluster` is used + if (self != null) { + self.send(AttachCompletedRebuildUI(app.id)) + } // Application UI is successfully rebuilt, so link the Master UI to it // NOTE - app.appUIUrlAtHistoryServer is volatile app.appUIUrlAtHistoryServer = Some(ui.basePath) |