sunchao commented on code in PR #58243:
URL: https://github.com/apache/spark/pull/58243#discussion_r3940996475


##########
core/src/main/scala/org/apache/spark/SparkContext.scala:
##########
@@ -636,8 +638,19 @@ class SparkContext(config: SparkConf) extends Logging {
     }
 
     if (_conf.get(UI_REVERSE_PROXY)) {
-      val proxyUrl = 
_conf.get(UI_REVERSE_PROXY_URL).getOrElse("").stripSuffix("/")
-      System.setProperty("spark.ui.proxyBase", proxyUrl + "/proxy/" + 
_applicationId)
+      _previousProxyBase = sys.props.get("spark.ui.proxyBase")
+      val baseProxyUrl = _conf.get(UI_REVERSE_PROXY_URL)
+        .orElse(_previousProxyBase)

Review Comment:
   [P2] Avoid inheriting a previous YARN application's proxy path
   
   After a YARN client application is stopped, `spark.ui.proxyBase` can still 
contain its application-specific `/proxy/application_<old-id>`: 
`YarnSchedulerBackend.addWebUIFilter` sets this property, and YARN shutdown 
leaves it intact. If the same JVM then creates a standalone client context with 
`spark.ui.reverseProxy=true` and no `spark.ui.reverseProxyUrl`, this fallback 
produces `/proxy/application_<old-id>/proxy/app-<new-id>` instead of the 
parent's `/proxy/app-<new-id>`. The new application's UI links therefore target 
the old application path. The new stop guard does not prevent this transition 
because the preceding YARN context normally has reverse proxy disabled and 
never sets `_proxyBaseSetByContext`. Please distinguish an application-specific 
proxy base from an externally supplied deployment prefix, and cover the 
YARN-to-standalone context transition. This is source-traced rather than 
runtime-reproduced.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to