Repository: spark
Updated Branches:
  refs/heads/master 82fee9d9a -> 7ce2a33c3


[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 <[email protected]>

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


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/7ce2a33c
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/7ce2a33c
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/7ce2a33c

Branch: refs/heads/master
Commit: 7ce2a33c3acffa17ae32f48ebb40b69b9b36dae4
Parents: 82fee9d
Author: Steve Loughran <[email protected]>
Authored: Mon May 11 13:35:06 2015 -0700
Committer: Patrick Wendell <[email protected]>
Committed: Mon May 11 13:35:42 2015 -0700

----------------------------------------------------------------------
 core/src/main/scala/org/apache/spark/ui/JettyUtils.scala | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/7ce2a33c/core/src/main/scala/org/apache/spark/ui/JettyUtils.scala
----------------------------------------------------------------------
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 dfd6fdb..06e6162 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()


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

Reply via email to