Akka a lot of (100+) threads with "TIMED_WAITING (parking)"

Hi folks,

I am experiencing a problem with a huge amount of parked threads on my server. I am not doing any long-running blocking work in my actors.

Do you have any idea how to fix such a problem, or how to start debugging it?

Here is an example of one thread in the thread dump:

"core-8436" #21625 prio=5 os_prio=0 cpu=288.60ms elapsed=59.12s tid=0x00007fc0b3194000 nid=0x229dbb waiting on condition  [0x00007fc064918000]
   java.lang.Thread.State: TIMED_WAITING (parking)
	at jdk.internal.misc.Unsafe.park(java.base@11.0.12/Native Method)
	- parking to wait for  <0x000000071d5b2890> (a java.util.concurrent.SynchronousQueue$TransferStack)
	at java.util.concurrent.locks.LockSupport.parkNanos(java.base@11.0.12/Unknown Source)
	at java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(java.base@11.0.12/Unknown Source)
	at java.util.concurrent.SynchronousQueue$TransferStack.transfer(java.base@11.0.12/Unknown Source)
	at java.util.concurrent.SynchronousQueue.poll(java.base@11.0.12/Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.getTask(java.base@11.0.12/Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(java.base@11.0.12/Unknown Source)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(java.base@11.0.12/Unknown Source)
	at java.lang.Thread.run(java.base@11.0.12/Unknown Source)

I am using Akka-http websocket integration to pipe messages to actors, and this is the bridge code, does it look correct? Is it possible that materializer is being blocked on something?

	def pipeToActor(props: ActorRef => Props): Flow[Message, Message, _] = {
		val (out, source) =
			Source.actorRef[ByteString](16, OverflowStrategy.dropNew)
			  .map(BinaryMessage.Strict).preMaterialize()(mat)

		val sink = Sink.actorRef(system.actorOf(props(out)), Status.Success(()))

		Flow.fromSinkAndSource(sink, source)
	}

I think preMaterialize()(mat) is a blocking operation.

Hi @strelec,

Akka itself uses a ForkJoinPoolExecutor by default, so the question is, what created the ThreadPoolExecutor? Do you know where the name core comes from?

Johannes