Skip to content

Commit be6d96c

Browse files
committed
SPARK-1324: SparkUI Should Not Bind to SPARK_PUBLIC_DNS
/cc @aarondav and @andrewor14 Author: Patrick Wendell <[email protected]> Closes apache#231 from pwendell/ui-binding and squashes the following commits: e8025f8 [Patrick Wendell] SPARK-1324: SparkUI Should Not Bind to SPARK_PUBLIC_DNS
1 parent e15e574 commit be6d96c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/src/main/scala/org/apache/spark/ui/SparkUI.scala

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ private[spark] class SparkUI(
4747

4848
val securityManager = if (live) sc.env.securityManager else new SecurityManager(conf)
4949

50-
private val host = Option(System.getenv("SPARK_PUBLIC_DNS")).getOrElse(Utils.localHostName())
50+
private val bindHost = Utils.localHostName()
51+
private val publicHost = Option(System.getenv("SPARK_PUBLIC_DNS")).getOrElse(bindHost)
5152
private val port = conf.get("spark.ui.port", SparkUI.DEFAULT_PORT).toInt
5253
private var serverInfo: Option[ServerInfo] = None
5354

@@ -79,8 +80,8 @@ private[spark] class SparkUI(
7980
/** Bind the HTTP server which backs this web interface */
8081
def bind() {
8182
try {
82-
serverInfo = Some(startJettyServer(host, port, handlers, sc.conf))
83-
logInfo("Started Spark Web UI at http://%s:%d".format(host, boundPort))
83+
serverInfo = Some(startJettyServer(bindHost, port, handlers, sc.conf))
84+
logInfo("Started Spark Web UI at http://%s:%d".format(publicHost, boundPort))
8485
} catch {
8586
case e: Exception =>
8687
logError("Failed to create Spark JettyUtils", e)
@@ -111,7 +112,7 @@ private[spark] class SparkUI(
111112
logInfo("Stopped Spark Web UI at %s".format(appUIAddress))
112113
}
113114

114-
private[spark] def appUIAddress = "http://" + host + ":" + boundPort
115+
private[spark] def appUIAddress = "http://" + publicHost + ":" + boundPort
115116

116117
}
117118

0 commit comments

Comments
 (0)