Fork me on GitHub
#core-async
<
2022-02-17
>
winsome21:02:18

The docstring for <!! says "Not intended for use in direct or transitive calls from (go ...) blocks", but what can I expect to go wrong if I do use it there?

Alex Miller (Clojure team)21:02:57

you can block your entire go pool and deadlock your app

Alex Miller (Clojure team)21:02:26

(he says, from experience)

😃 2
winsome21:02:20

Glad I don't have to walk where you have 🙏

Alex Miller (Clojure team)21:02:28

the go pool is a fixed size thread pool and only expects to be parked by the go, not blocked by other calls. <!! (and other !!) calls can block, ergo that's usually bad, and often only bad like a year after you put it into production. that said, there might be circumstances where you know more (like the chan is a sliding/dropping buffer so never blocks, or whatever)

souenzzo22:02:58

@winsome you can add -Dclojure.core.async.go-checking=true to your "JVM properties" to help you to avoid <!! calls inside go blocks

👍 1
Alex Miller (Clojure team)22:02:25

(but note that won't protect you from other blocking calls)

hiredman23:02:30

and it will complain about !! calls even if they can never block (putting on a newly created chan 1)