Fork me on GitHub
#core-async
<
2019-12-25
>
Jakub Holý (HolyJak)10:12:40

(Moved to #clojure which seems more appropriate)

Jakub Holý (HolyJak)11:12:22

Does anyone know why does core.async print errors in go blocks to stderr? I could not find it anywhere... (See the 2nd part of the post below, under Update, using clj to test the behavior)

hiredman16:12:14

You are derefing the future which causes the exception thrown in the future to be re-thrown on the thread that derefs it

Jakub Holý (HolyJak)18:12:26

I see, thank you. But what about the core.async case? Is it the same case due to <!!?

hiredman21:12:35

No, that is why you get different behavior

hiredman21:12:00

And also why in neither case the jvm uncaught exception handler is triggered, in both cases the exception is caught, so this is also a good example of why using the uncaught exception handler is unreliable

hiredman21:12:23

It is global, doesn't compose, and easily unintentionally bypassed

Jakub Holý (HolyJak)22:12:04

So, in the case of core.async, what is it that catches and prints the exception?

hiredman22:12:38

I am not sure, but almost by definition exceptions in a threadpool won't make it to the uncaught exception handler

hiredman22:12:22

Because a threadpool running tasks won't let the exception bubble all the way up and kill the thread

Jakub Holý (HolyJak)22:12:48

Thanks, I will have a look at the thread pool's source code then.

tianshu12:12:08

Recently rust library async-std introduce a new runtime, which can detect if a thread is blocking, so it doesn't need distinguish async/block anymore. Is this possible for core.async?

noisesmith18:12:06

we don't have any non-blocking threads, so I'm not sure if that can translate

noisesmith18:12:26

a go block gets rewritten into state-machine callbacks attached to channels

Jakub Holý (HolyJak)20:12:49

I've just published "Error handling in Clojure Core.Async" focusing on the higher-level constructs such as pipeline and transduce and am looking for feedback from people that know core.async much better then me, i.e. you. Please help! Thank you! https://blog.jakubholy.net/2019/core-async-error-handling/

👍 8
Charles Fourdrignier15:12:28

Just discover a/split in your post. Thanks ! Note : mbrainz-importer is one of my reference too. ^^

❤️ 4