core-async

tianshu 2019-03-12T11:16:59.019500Z

I met the problem that many async-thread-macro thread will be created and stay in parking. This is the stacktrace of the parking thread:

"async-thread-macro-149" #535 daemon prio=5 os_prio=0 tid=0x00007f5468032800 nid=0x3e89 waiting on condition [0x00007f541e4e3000]
   java.lang.Thread.State: WAITING (parking)
	at sun.misc.Unsafe.park(Native Method)
	- parking to wait for  <0x00000006cfae0d30> (a java.util.concurrent.CountDownLatch$Sync)
	at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997)
	at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
	at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
	at clojure.core$promise$reify__8486.deref(core.clj:7109)
	at clojure.core$deref.invokeStatic(core.clj:2320)
	at clojure.core$deref.invoke(core.clj:2306)
	at clojure.core.async$_LT__BANG__BANG_.invokeStatic(async.clj:115)
	at clojure.core.async$_LT__BANG__BANG_.invoke(async.clj:107)
	at clojure.core.async$pipeline_STAR_$fn__11939.invoke(async.clj:506)
	at clojure.core.async$thread_call$fn__11850.invoke(async.clj:442)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
the stacktrace can't give me detail where the problem happens. how can I investigate further?

tianshu 2019-03-12T12:25:33.021100Z

It's likely caused by I didn't close the channel while another process consuming this channel. I found the problem process one by one testing.

2019-03-12T16:58:44.021500Z

doesn't that just mean that the thread didn't exit yet?

2019-03-12T16:59:14.022300Z

it looks like (thread (<!! ...)) and it's just waiting for that <!!

2019-03-12T16:59:33.022600Z

LT_BANG__BANG is <!!

2019-03-12T17:19:07.022800Z

yes

2019-03-12T17:19:24.023200Z

you have a pipeline-blocking somewhere and didn't close the input to it

2019-03-12T17:20:01.023700Z

maybe not a pipeline-blocking

2019-03-12T17:20:45.024600Z

actually, you know, I bet you put a &lt;!! blocking op in a pipeline or a pipeline-async

2019-03-12T17:25:23.025300Z

no, line 506 is pipeline-blocking, so you have a pipeline-blocking that is up and waiting for work