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

sarutak 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 a911310f696e [SPARK-54877][UI] Make display stacktrace on UI error 
page configurable
a911310f696e is described below

commit a911310f696ef97d67193885f28876281ef9d57b
Author: Cheng Pan <[email protected]>
AuthorDate: Fri Jan 2 12:58:23 2026 +0900

    [SPARK-54877][UI] Make display stacktrace on UI error page configurable
    
    ### What changes were proposed in this pull request?
    
    This PR adds a new configuration `spark.ui.showErrorStacks` to allow user 
to disable displaying stacktrace on UI error page.
    
    ### Why are the changes needed?
    
    To avoid exposing much internal info of the service for security purposes.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No, the default value of the newly added configuration does not change the 
existing behavior.
    
    ### How was this patch tested?
    
    Manually tested, modified AllJobsPage.scala to simulate an internal error.
    
    Run with `--conf spark.ui.showErrorStacks=true` (default behavior)
    
    <img width="894" height="756" alt="image" 
src="https://github.com/user-attachments/assets/cb2e77ef-175a-43b0-bab2-1cb9e294be27";
 />
    
    Run with `--conf spark.ui.showErrorStacks=false`
    
    <img width="885" height="206" alt="image" 
src="https://github.com/user-attachments/assets/50d53286-eb11-466e-8c80-52a88a1806e1";
 />
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #53656 from pan3793/SPARK-54877.
    
    Authored-by: Cheng Pan <[email protected]>
    Signed-off-by: Kousuke Saruta <[email protected]>
---
 core/src/main/scala/org/apache/spark/internal/config/UI.scala | 6 ++++++
 core/src/main/scala/org/apache/spark/ui/JettyUtils.scala      | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/core/src/main/scala/org/apache/spark/internal/config/UI.scala 
b/core/src/main/scala/org/apache/spark/internal/config/UI.scala
index fe5a52debdaf..b3c564c5b6f9 100644
--- a/core/src/main/scala/org/apache/spark/internal/config/UI.scala
+++ b/core/src/main/scala/org/apache/spark/internal/config/UI.scala
@@ -271,4 +271,10 @@ private[spark] object UI {
     .version("4.0.0")
     .timeConf(TimeUnit.MILLISECONDS)
     .createWithDefaultString("30s")
+
+  val UI_SHOW_ERROR_STACKS = ConfigBuilder("spark.ui.showErrorStacks")
+    .doc("Whether to display stack traces in the UI error pages.")
+    .version("4.2.0")
+    .booleanConf
+    .createWithDefault(true)
 }
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 bd7848c76437..fedc6bb27309 100644
--- a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
+++ b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
@@ -265,7 +265,7 @@ private[spark] object JettyUtils extends Logging {
     val server = new Server(pool)
 
     val errorHandler = new ErrorHandler()
-    errorHandler.setShowStacks(true)
+    errorHandler.setShowStacks(conf.get(UI_SHOW_ERROR_STACKS))
     errorHandler.setServer(server)
     server.addBean(errorHandler)
 


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

Reply via email to