diff options
author | Steve Loughran <stevel@hortonworks.com> | 2015-05-11 13:35:06 -0700 |
---|---|---|
committer | Patrick Wendell <patrick@databricks.com> | 2015-05-11 13:35:42 -0700 |
commit | 7ce2a33c3acffa17ae32f48ebb40b69b9b36dae4 (patch) | |
tree | 0d602f225c065dc427451690d8221cee917aea89 /core | |
parent | 82fee9d9aad2c9ba2fb4bd658579fe99218cafac (diff) | |
download | spark-7ce2a33c3acffa17ae32f48ebb40b69b9b36dae4.tar.gz spark-7ce2a33c3acffa17ae32f48ebb40b69b9b36dae4.tar.bz2 spark-7ce2a33c3acffa17ae32f48ebb40b69b9b36dae4.zip |
[SPARK-7508] JettyUtils-generated servlets to log & report all errors
Patch for SPARK-7508
This logs warn then generates a response which include the message body and stack trace as text/plain, no-cache. The exit code is 500.
In practise (in some tests in SPARK-1537 to be precise), jetty is getting in between this servlet and the web response the user sees —the body of the response is lost for any error response (500, even 404 and bad request). The standard Jetty handlers must be getting in the way.
This patch doesn't address that, it ensures that
1. if the jetty handlers were put to one side the users would see the errors
2. at least the exceptions appear in the server-side logs.
This is better to users saying "I saw a 500 error" and you not having anything in the logs to see what went wrong.
Author: Steve Loughran <stevel@hortonworks.com>
Closes #6033 from steveloughran/stevel/feature/SPARK-7508-JettyUtils and squashes the following commits:
584836f [Steve Loughran] SPARK-7508 drop trailing semicolon
ad6f185 [Steve Loughran] SPARK-7508: jetty handles exception reporting itself; spark just sets this up and logs exceptions before being relayed
258d9f9 [Steve Loughran] SPARK-7508 fix typo manually-edited before patch pushed
69c8263 [Steve Loughran] SPARK-7508 JettyUtils-generated servlets to log & report all errors
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/org/apache/spark/ui/JettyUtils.scala | 6 |
1 files changed, 6 insertions, 0 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 dfd6fdb5e9..06e616220c 100644 --- a/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala +++ b/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala @@ -78,6 +78,9 @@ private[spark] object JettyUtils extends Logging { } catch { case e: IllegalArgumentException => response.sendError(HttpServletResponse.SC_BAD_REQUEST, e.getMessage) + case e: Exception => + logWarning(s"GET ${request.getRequestURI} failed: $e", e) + throw e } } // SPARK-5983 ensure TRACE is not supported @@ -217,6 +220,9 @@ private[spark] object JettyUtils extends Logging { val pool = new QueuedThreadPool pool.setDaemon(true) server.setThreadPool(pool) + val errorHandler = new ErrorHandler() + errorHandler.setShowStacks(true) + server.addBean(errorHandler) server.setHandler(collection) try { server.start() |