Fork me on GitHub
#core-async
<
2019-07-03
>
souenzzo15:07:07

How can I detect which library/go-block is locking my system? my system has locked, and I solved it with -Dclojure.core.async.pool-size=500

alexmiller15:07:47

whichever one is doing IO?

alexmiller16:07:24

if you take a thread dump, it's probably obvious

hiredman16:07:21

like, I mean, first guess is look at the ones you wrote

souenzzo16:07:13

Lot of threads in many states:

java.lang.Thread.State: RUNNABLE
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
   java.lang.Thread.State: TIMED_WAITING (parking)
   java.lang.Thread.State: TIMED_WAITING (sleeping)
   java.lang.Thread.State: WAITING (on object monitor)
   java.lang.Thread.State: WAITING (parking)
What should I look for? There is some doc about debug it? What the name of this problem (so I can search resources my own)

hiredman16:07:52

"doing io in go blocks"

hiredman16:07:34

if you are digging through thread dumps you should not set the core.async pool size so high

hiredman16:07:13

but even before digging through threaddumps I would go back and look at the code I wrote to see if I am doing anything blocking in a go block

souenzzo16:07:37

I'm back on default core.async (that freezes my system) with my system frozen

hiredman16:07:56

or in a transducer on a channel that might run on the async threadpool

hiredman16:07:08

when you say freezes your system, what do you mean?

hiredman16:07:30

is it live lock or dead lock?

hiredman16:07:25

dead lock is nothing happening (so low resource usage) live lock is lots going on (high resource usage) but nothing happening

souenzzo16:07:12

There is a deftest block that freezes. It simply stops, no more logs, do not end and CPU goes to "0%"

souenzzo16:07:09

Many of java.lang.Thread.State: WAITING (parking) are caused due (<!! p) inside datomic.client.api where p is a clojure.core/promise. Is it relevant?

hiredman16:07:13

my guess there would be you are waiting on a channel that doesn't have anything written to it somewhere

souenzzo16:07:37

s/many/all "async-dispatch" threads/

hiredman16:07:47

what datomic operations are you doing in go blocks?

alexmiller16:07:32

<!! is a blocking operation and you shouldn't do that in a go block

souenzzo16:07:50

d/pull inside #pathom resolvers

alexmiller16:07:07

d/pull is a database op, which should always be assumed to be IO

alexmiller16:07:13

and thus don't do it in a go block

souenzzo16:07:27

move to client.async should solve it?

alexmiller17:07:51

probably better, but I would read the fine print and still probably shouldn't do it in a go block - prob a better question for #datomic. doing this in pipeline-blocking or pipeline-async or a no-go thread prob better

👍 1