core-async

Jakub Holý 2019-12-25T10:59:40.051500Z

(Moved to #clojure which seems more appropriate)

Jakub Holý 2019-12-25T11:31:22.052100Z

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)

tianshu 2019-12-25T12:59:08.054200Z

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?

2019-12-26T18:50:06.063300Z

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

2019-12-26T18:50:26.063500Z

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

2019-12-25T16:38:14.054300Z

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ý 2019-12-25T18:49:26.054500Z

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

Jakub Holý 2019-12-25T20:06:49.056Z

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/

👍 2
2019-12-27T15:05:28.063700Z

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

❤️ 1
2019-12-25T21:15:35.056200Z

No, that is why you get different behavior

2019-12-25T21:17:00.056400Z

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

2019-12-25T21:18:23.056600Z

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

Jakub Holý 2019-12-25T22:18:04.056800Z

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

2019-12-25T22:28:38.057Z

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

2019-12-25T22:29:22.057200Z

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

Jakub Holý 2019-12-25T22:51:48.057400Z

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