Permalink
Browse files

Merge branch 'master' into 0.9.0

  • Loading branch information...
nathanmarz committed Nov 8, 2012
2 parents 33eb6b0 + a85d809 commit 2a41f2108e40a2145416e98c052bb13c773a8219
Showing with 25 additions and 6 deletions.
  1. +1 −0 CHANGELOG.md
  2. +24 −6 src/clj/backtype/storm/ui/core.clj
View
@@ -33,6 +33,7 @@
* Adding testTuple methods for easily creating Tuple instances to Testing API (thanks xumingming)
* Trident now throws an error during construction of a topology when try to select fields that don't exist in a stream (thanks xumingming)
* Compute the capacity of a bolt based on execute latency and #executed over last 10 minutes and display in UI
+ * Storm UI displays exception instead of blank page when there's an error rendering the page (thanks Frostman)
* Bug fix: Fix deadlock bug due to variant of dining philosophers problem. Spouts now use an overflow buffer to prevent blocking and guarantee that it can consume the incoming queue of acks/fails.
* Bug fix: Fix race condition in supervisor that would lead to supervisor continuously crashing due to not finding "stormconf.ser" file for an already killed topology
* Bug fix: bin/storm script now displays a helpful error message when an invalid command is specified
@@ -379,10 +379,11 @@
(link-to (url-format "/topology/%s/component/%s" storm-id id) id))
(defn render-capacity [capacity]
- [:span (if (> capacity 0.9)
- {:class "red"}
- {})
- (float-str capacity)])
+ (let [capacity (nil-to-zero capacity)]
+ [:span (if (> capacity 0.9)
+ {:class "red"}
+ {})
+ (float-str capacity)]))
(defn compute-executor-capacity [^ExecutorSummary e]
(let [stats (.get_stats e)
@@ -404,6 +405,7 @@
(defn compute-bolt-capacity [executors]
(->> executors
(map compute-executor-capacity)
+ (map nil-to-zero)
(apply max)))
(defn spout-comp-table [top-id summ-map errors window include-sys?]
@@ -774,9 +776,25 @@
(route/resources "/")
(route/not-found "Page not found"))
+(defn exception->html [ex]
+ (concat
+ [[:h2 "Internal Server Error"]]
+ [[:pre (let [sw (java.io.StringWriter.)]
+ (.printStackTrace ex (java.io.PrintWriter. sw))
+ (.toString sw))]]))
+
+(defn catch-errors [handler]
+ (fn [request]
+ (try
+ (handler request)
+ (catch Exception ex
+ (-> (resp/response (ui-template (exception->html ex)))
+ (resp/status 500)
+ (resp/content-type "text/html"))
+ ))))
+
(def app
- (handler/site main-routes)
- )
+ (handler/site (-> main-routes catch-errors )))
(defn start-server! [] (run-jetty app {:port (Integer. (*STORM-CONF* UI-PORT))
:join? false}))

0 comments on commit 2a41f21

Please sign in to comment.