Skip to content

Commit a911310

Browse files
pan3793sarutak
authored andcommitted
[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]>
1 parent eaed471 commit a911310

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

core/src/main/scala/org/apache/spark/internal/config/UI.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,4 +271,10 @@ private[spark] object UI {
271271
.version("4.0.0")
272272
.timeConf(TimeUnit.MILLISECONDS)
273273
.createWithDefaultString("30s")
274+
275+
val UI_SHOW_ERROR_STACKS = ConfigBuilder("spark.ui.showErrorStacks")
276+
.doc("Whether to display stack traces in the UI error pages.")
277+
.version("4.2.0")
278+
.booleanConf
279+
.createWithDefault(true)
274280
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ private[spark] object JettyUtils extends Logging {
265265
val server = new Server(pool)
266266

267267
val errorHandler = new ErrorHandler()
268-
errorHandler.setShowStacks(true)
268+
errorHandler.setShowStacks(conf.get(UI_SHOW_ERROR_STACKS))
269269
errorHandler.setServer(server)
270270
server.addBean(errorHandler)
271271

0 commit comments

Comments
 (0)