Skip to content
Snippets Groups Projects
Commit 86fcdaef authored by Sean Owen's avatar Sean Owen
Browse files

SPARK-1965 [WEBUI] Spark UI throws NPE on trying to load the app page for non-existent app

Don't throw NPE if appId is unknown. kayousterhout is this a decent enough band-aid for avoiding a full-blown NPE? it should just render empty content instead

Author: Sean Owen <sowen@cloudera.com>

Closes #4777 from srowen/SPARK-1965 and squashes the following commits:

7e16590 [Sean Owen] Update app not found message
cb878d6 [Sean Owen] Return basic "not found" page for unknown appId
d8270da [Sean Owen] Don't throw NPE if appId is unknown
parent f91298e2
No related branches found
No related tags found
No related merge requests found
...@@ -24,6 +24,7 @@ import scala.xml.Node ...@@ -24,6 +24,7 @@ import scala.xml.Node
import akka.pattern.ask import akka.pattern.ask
import org.json4s.JValue import org.json4s.JValue
import org.json4s.JsonAST.JNothing
import org.apache.spark.deploy.{ExecutorState, JsonProtocol} import org.apache.spark.deploy.{ExecutorState, JsonProtocol}
import org.apache.spark.deploy.DeployMessages.{MasterStateResponse, RequestMasterState} import org.apache.spark.deploy.DeployMessages.{MasterStateResponse, RequestMasterState}
...@@ -44,7 +45,11 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app ...@@ -44,7 +45,11 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app
val app = state.activeApps.find(_.id == appId).getOrElse({ val app = state.activeApps.find(_.id == appId).getOrElse({
state.completedApps.find(_.id == appId).getOrElse(null) state.completedApps.find(_.id == appId).getOrElse(null)
}) })
JsonProtocol.writeApplicationInfo(app) if (app == null) {
JNothing
} else {
JsonProtocol.writeApplicationInfo(app)
}
} }
/** Executor details for a particular application */ /** Executor details for a particular application */
...@@ -55,6 +60,10 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app ...@@ -55,6 +60,10 @@ private[spark] class ApplicationPage(parent: MasterWebUI) extends WebUIPage("app
val app = state.activeApps.find(_.id == appId).getOrElse({ val app = state.activeApps.find(_.id == appId).getOrElse({
state.completedApps.find(_.id == appId).getOrElse(null) state.completedApps.find(_.id == appId).getOrElse(null)
}) })
if (app == null) {
val msg = <div class="row-fluid">No running application with ID {appId}</div>
return UIUtils.basicSparkPage(msg, "Not Found")
}
val executorHeaders = Seq("ExecutorID", "Worker", "Cores", "Memory", "State", "Logs") val executorHeaders = Seq("ExecutorID", "Worker", "Cores", "Memory", "State", "Logs")
val allExecutors = (app.executors.values ++ app.removedExecutors).toSet.toSeq val allExecutors = (app.executors.values ++ app.removedExecutors).toSet.toSeq
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment