clojure - Jetty threads getting blocked and dead locked -
i using jetty "7.6.8.v20121106" part of https://github.com/ring-clojure/ring/tree/master/ring-jetty-adapter server.
i making calls using http://http-kit.org/ following code. making server calls ignoring response. finding server threads become blocked/deadlocked after that. seems easy way bring server down , wanted understand going on here.
code client is:
(require '[org.httpkit.client :as hk-client]) (defn hget [id] (hk-client/get (str "http://localhost:5000/v1/pubapis/auth/ping?ping=" id))) (doall (map hget (take 100 (range))))) ; gives problem (doall (map deref (map hget (take 100 (range)))))) ; doesn't give problem
threads blocked at
sun.nio.cs.streamencoder.write(streamencoder.java:118)
and deadlocked at
java.io.printstream.write(printstream.java:479)
would appreciate if can going on over here.
finally found problem was. took lot of digging through , starting sample project find this. when started learning clojure , copied following somewhere logging:
(defn log [msg & vals] (let [line (apply format msg vals)] (locking system/out (println line))))
the line locking on there causing dead lock in situation. not know enough concurrency solve this. create separate question that.
removing line fixes problem.
Comments
Post a Comment