Upmap hangs if there is an AssertionError in the mapping function
ducky427 opened this issue · 5 comments
ducky427 commented
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))
ducky427 commented
The program doesn't hang with the following slow
function:
(defn slow
[n]
(throw (Exception. "my exception message")))
leon-barrett commented
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.
leon-barrett commented
I believe this is fixed. I'll release a new Claypoole 0.3.1 soon.
leon-barrett commented
Released. Thanks again for catching this!
ducky427 commented
Thanks a lot for fixing this.
Cheers!