clj-commons/claypoole

Upmap hangs if there is an AssertionError in the mapping function

ducky427 opened this issue · 5 comments

upmap method in com.climate.claypoole hangs if the mapping function throws a java.lang.AssertionError. However pmap does handle this correctly.

Simple example:

(ns test-clay.core
  (require [com.climate.claypoole :as cp])
  (:gen-class))

(def pool (cp/threadpool 4))

(defn slow
  [n]
  (assert (not= 5 n) "n is 5"))

(defn -main
  [& args]
  (doall (cp/pmap pool slow (range 10)))
  (cp/shutdown pool)
  (shutdown-agents))

The program doesn't hang with the following slow function:

(defn slow
  [n]
  (throw (Exception. "my exception message")))

Thanks for the report! I think the issue is that there's handling of Exceptions, but not other Throwables, and AssertionError is not an Exception. I'll work on catching and correctly re-throwing all Throwables.

I believe this is fixed. I'll release a new Claypoole 0.3.1 soon.

Released. Thanks again for catching this!

Thanks a lot for fixing this.

Cheers!