core-async

souenzzo 2019-07-03T15:59:07.182300Z

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

alexmiller 2019-07-03T15:59:47.182500Z

whichever one is doing IO?

alexmiller 2019-07-03T16:00:24.182800Z

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

2019-07-03T16:25:21.183200Z

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

souenzzo 2019-07-03T16:43:13.185100Z

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)

2019-07-03T16:45:52.185500Z

"doing io in go blocks"

2019-07-03T16:46:34.186100Z

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

2019-07-03T16:47:13.187Z

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

souenzzo 2019-07-03T16:47:37.187700Z

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

2019-07-03T16:47:56.188Z

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

2019-07-03T16:50:08.188400Z

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

2019-07-03T16:50:30.188700Z

is it live lock or dead lock?

2019-07-03T16:51:25.189500Z

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

souenzzo 2019-07-03T16:52:12.190300Z

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

souenzzo 2019-07-03T16:54:09.191900Z

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?

2019-07-03T16:54:13.192Z

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

souenzzo 2019-07-03T16:55:37.192800Z

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

2019-07-03T16:56:47.193900Z

what datomic operations are you doing in go blocks?

alexmiller 2019-07-03T16:57:32.194500Z

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

souenzzo 2019-07-03T16:57:50.194900Z

d/pull inside #pathom resolvers

alexmiller 2019-07-03T16:58:07.195400Z

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

alexmiller 2019-07-03T16:58:13.195900Z

and thus don't do it in a go block

souenzzo 2019-07-03T16:58:27.196300Z

move to client.async should solve it?

alexmiller 2019-07-03T17:00:51.198200Z

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