core-async

Jakub Holý 2019-07-10T13:44:02.199100Z

Any tips how to handle errors that happen inside f in (pipeline-blocking 5 my-out-chan (map f) (to-chan my-col))? I would like to throw an error to the caller of my code, including the number of exceptions and one of them. Should I use the undocumented ex-handler parameter, or wrap f in try-catch and send exceptions to another helper channel and then check it for content before returning or, instead of a helper channel, make the try-cache return either {:data <result>} or {:exception <the exc.>} and then filter the resulting channel/collection for any errors? What do people do? Thank you!!!

markmarkmark 2019-07-10T15:56:40.199600Z

ex-handler is documented in the docs for chan

👍 1
Jakub Holý 2019-07-10T16:01:24.199800Z

Thanks! I wouldn't think of looking there.

souenzzo 2019-07-10T16:22:19.201200Z

there is how detect a blocking operation inside a go block?

2019-07-10T16:36:13.202100Z

that's not something you can generally detect, but if a go block is blocked that can be detected by looking at the stack traces of all running threads

👍 1
souenzzo 2019-07-10T16:40:08.202300Z

found (Thread/getAllStackTraces). I will play with it 🙂 tnks

2019-07-10T16:41:50.202500Z

in most terminals Control-\ does the same thing

2019-07-10T16:42:03.202700Z

there's also jstack <pid> which you can run from another terminal

2019-07-10T16:44:05.202900Z

(map (comp pprint seq) (vals (Thread/getAllStackTraces)))

2019-07-10T16:50:09.203100Z

better (doseq [trace (vals (Thread/getAllStackTraces))] (println (clojure.string/join "\n" trace)))

✔️ 1