Fork me on GitHub
#core-async
<
2016-09-20
>
hiredman04:09:41

my brain must be going

hiredman04:09:44

the go macro generates code that grabs the current binding frame and stashes it away, and resets that frame as the current frame every time the state machine runs

hiredman04:09:29

but after the state machine exits, there is no code that saves the current binding frame again, so of course if the binding frame is updated those updates don't propagate across suspend/resumes of goroutines, which explains why a binding around a parking operation explodes

pre07:09:10

If you write a macro that persists the binding frame to a persistent queue, like SQS, then you get best of both worlds.

val_waeselynck13:09:46

(require '[clojure.core.async :as a])
(a/<!! (a/go
         (try :a
           (finally (a/<! (a/go :b))))))
=> :b

val_waeselynck13:09:00

seems like a bug to me.

val_waeselynck13:09:29

Should I file an issue ? I've seen several try-catch related issues on the JIRA but I have not recognized this one

Alex Miller (Clojure team)13:09:14

and you’d expect :a ?

Alex Miller (Clojure team)13:09:39

yeah, I’d say that’s a bug

val_waeselynck14:09:06

@alexmiller reproduced in [org.clojure/core.async "0.1.346.0-17112a-alpha"] on the JVM

val_waeselynck14:09:16

Do you want me to file it?

hiredman15:09:57

There is already a bug for that

hiredman15:09:15

In fact many open issues against exception handling in the go macro (which the finally thing is part of)

val_waeselynck15:09:36

@hiredman ah, my bad, just created the issue 😕

hiredman15:09:05

or leave it, I don't know

val_waeselynck15:09:31

I think I can't unsubmit

hiredman15:09:38

there are lots of open issues all connected to compilation of try/catch/finally in go blocks being broken

val_waeselynck15:09:10

yeah not the first time I got bitten by some corener case

hiredman16:09:01

I updated the patch on http://dev.clojure.org/jira/browse/ASYNC-169 with some tests that cover test cases in several other exception handling related issues

hiredman16:09:07

I added a patch to http://dev.clojure.org/jira/browse/ASYNC-170 (mentioned yesterday) that fixes parking operations inside bindings