Skip to content

Commit ca39985

Browse files
author
Andrew Or
committed
[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 apache#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 apache#10417 from andrewor14/fix-harmless-npe. (cherry picked from commit d655d37) Signed-off-by: Andrew Or <andrew@databricks.com>
1 parent c754a08 commit ca39985

File tree

1 file changed

+5
-1
lines changed
  • core/src/main/scala/org/apache/spark/deploy/master

1 file changed

+5
-1
lines changed

core/src/main/scala/org/apache/spark/deploy/master/Master.scala

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,11 @@ private[deploy] class Master(
979979

980980
futureUI.onSuccess { case Some(ui) =>
981981
appIdToUI.put(app.id, ui)
982-
self.send(AttachCompletedRebuildUI(app.id))
982+
// `self` can be null if we are already in the process of shutting down
983+
// This happens frequently in tests where `local-cluster` is used
984+
if (self != null) {
985+
self.send(AttachCompletedRebuildUI(app.id))
986+
}
983987
// Application UI is successfully rebuilt, so link the Master UI to it
984988
// NOTE - app.appUIUrlAtHistoryServer is volatile
985989
app.appUIUrlAtHistoryServer = Some(ui.basePath)

0 commit comments

Comments
 (0)