apa512 / clj-rethinkdb

Eclipse Public License 1.0
204 stars 42 forks source link

Blocking if number of connections >= number of threads in core.async executor #132

Closed martinklepsch closed 8 years ago

martinklepsch commented 8 years ago
(defn repro []
  (let [mk-conn #(r/connect :host "127.0.0.1" :port 28015 :db "test")
        n     (-> (Runtime/getRuntime)
                  (.availableProcessors)
                  (* 2)
                  (+ 42))
        conns (doall (map (fn [_] (mk-conn)) (range n)))]
    (rethinkdb.core/close (rand-nth conns))))

n is the same as the number of threads used in the core.async executor

Just opening this to track & in case someone else has a quick idea otherwise I'll likely get to the bottom of this later.

danielcompton commented 8 years ago

I think ghadi had a good idea of doing the blocking work in a thread. Happy to take a PR for that, or alternatively one which rips out all of the Clojure connection handling and replaces it with the Java driver.

apa512 commented 8 years ago

This shoudn't be a problem with the new aleph code, which is merged into master and deployed as 0.14.5-SNAPSHOT.