You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2022/06/22 22:08:33 UTC

[spark] branch master updated: [SPARK-39559][CORE][WEBUI] Support IPv6 in WebUI

This is an automated email from the ASF dual-hosted git repository.

dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git


The following commit(s) were added to refs/heads/master by this push:
     new b50d094bdb6 [SPARK-39559][CORE][WEBUI] Support IPv6 in WebUI
b50d094bdb6 is described below

commit b50d094bdb6448236b24531aec773895eadd211f
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Wed Jun 22 15:08:21 2022 -0700

    [SPARK-39559][CORE][WEBUI] Support IPv6 in WebUI
    
    ### What changes were proposed in this pull request?
    
    This PR aims to support IPv6 in WebUI.
    
    Since `startJettyServer` expects `hostName`, we use `Utils.localHostNameForURI`.
    https://github.com/apache/spark/blob/59eee98024dac42309f2e7196c7e68832317f284/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala#L241-L242
    
    ### Why are the changes needed?
    
    To support IPv6-only environment.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No.
    
    ### How was this patch tested?
    
    Pass the CIs.
    
    Closes #36958 from dongjoon-hyun/SPARK-39559.
    
    Authored-by: Dongjoon Hyun <do...@apache.org>
    Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
 core/src/main/scala/org/apache/spark/ui/JettyUtils.scala | 1 +
 core/src/main/scala/org/apache/spark/ui/WebUI.scala      | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
index 834e4dfc484..d8119fb9498 100644
--- a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
@@ -246,6 +246,7 @@ private[spark] object JettyUtils extends Logging {
       serverName: String = "",
       poolSize: Int = 200): ServerInfo = {
 
+    logInfo(s"Start Jetty $hostName:$port for $serverName")
     // Start the server first, with no connectors.
     val pool = new QueuedThreadPool(poolSize)
     if (serverName.nonEmpty) {
diff --git a/core/src/main/scala/org/apache/spark/ui/WebUI.scala b/core/src/main/scala/org/apache/spark/ui/WebUI.scala
index 4a49b98e246..2b96016476e 100644
--- a/core/src/main/scala/org/apache/spark/ui/WebUI.scala
+++ b/core/src/main/scala/org/apache/spark/ui/WebUI.scala
@@ -140,8 +140,8 @@ private[spark] abstract class WebUI(
   def initialize(): Unit
 
   def initServer(): ServerInfo = {
-    val host = Option(conf.getenv("SPARK_LOCAL_IP")).getOrElse("0.0.0.0")
-    val server = startJettyServer(host, port, sslOptions, conf, name, poolSize)
+    val hostName = Utils.localHostNameForURI()
+    val server = startJettyServer(hostName, port, sslOptions, conf, name, poolSize)
     server
   }
 
@@ -149,11 +149,10 @@ private[spark] abstract class WebUI(
   def bind(): Unit = {
     assert(serverInfo.isEmpty, s"Attempted to bind $className more than once!")
     try {
-      val host = Option(conf.getenv("SPARK_LOCAL_IP")).getOrElse("0.0.0.0")
       val server = initServer()
       handlers.foreach(server.addHandler(_, securityManager))
       serverInfo = Some(server)
-      logInfo(s"Bound $className to $host, and started at $webUrl")
+      logInfo(s"Bound $className to ${Utils.localHostNameForURI()}, and started at $webUrl")
     } catch {
       case e: Exception =>
         logError(s"Failed to bind $className", e)


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org