Akka dispatchers waiting for ever
Ported from a question on Stackoverflow.com suggested by Viktor Klang.
Recently, I've been developing different examples using Akka; for instance a playtool P2P model. For the evaluation, benchmarking, and understanding better, I tried to run the example using different types of dispatchers that Akka introduces.
The issue that I've been facing is that specifically using
I am interested to know if this is a deadlock due to application design? And, more importantly, how can I get to debug or delve into dealing with such as issue?
UPDATE. I decreased the
I tried the sample run with Akka Actor 2.0, 2.0.1, and 2.0.2-RC1 and it's the same result. Attachments are the short version of the source that I run for the test and evaluation.
Recently, I've been developing different examples using Akka; for instance a playtool P2P model. For the evaluation, benchmarking, and understanding better, I tried to run the example using different types of dispatchers that Akka introduces.
The issue that I've been facing is that specifically using
BalancingDispatcher
with a thread-pool-executor (which by default should be for this type of dispatcher), the application tends to enter a total waiting state; is this a deadlock?! When I use jstack to get the dump for the threads in the application, the prominent observation is that all dispatcher threads are in TIMED_WAITING
or WAITING
state.I am interested to know if this is a deadlock due to application design? And, more importantly, how can I get to debug or delve into dealing with such as issue?
UPDATE. I decreased the
Timeout
to see how it affects the run. The following exception is always thrown after the timeout passes:[ERROR] [06/01/2012 16:14:36.200] [main-6] [akka://main/user/p2p] error while creating actor
java.util.concurrent.TimeoutException: Futures timed out after [30000] milliseconds
at akka.dispatch.DefaultPromise.ready(Future.scala:834)
at akka.dispatch.DefaultPromise.ready(Future.scala:811)
at akka.dispatch.Await$.ready(Future.scala:64)
at nl.cwi.crisp.examples.p2p.scala.Network.<init>(Node.scala:137)
at nl.cwi.crisp.examples.p2p.scala.Main$$anonfun$14.apply(Node.scala:158)
at nl.cwi.crisp.examples.p2p.scala.Main$$anonfun$14.apply(Node.scala:158)
at akka.actor.ActorCell.newActor(ActorCell.scala:488)
at akka.actor.ActorCell.create$1(ActorCell.scala:506)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:591)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:191)
at akka.dispatch.Mailbox.run(Mailbox.scala:160)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
[ERROR] [06/01/2012 16:14:36.250] [main-6] [akka://main/user/p2p] error while processing ChildTerminated(Actor[akka://main/user/p2p/c1])
java.lang.NullPointerException
at akka.actor.ActorCell.handleChildTerminated(ActorCell.scala:749)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:599)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:191)
at akka.dispatch.Mailbox.run(Mailbox.scala:160)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
[ERROR] [06/01/2012 16:14:36.251] [main-6] [akka://main/user/p2p] exception during processing system messages, dropping 11 messages!
java.lang.NullPointerException
at akka.actor.ActorCell.handleChildTerminated(ActorCell.scala:749)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:599)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:191)
at akka.dispatch.Mailbox.run(Mailbox.scala:160)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
[ERROR] [06/01/2012 16:14:36.251] [main-6] [ActorSystem(main)] Uncaught error from thread [main-6]
java.lang.NullPointerException
at akka.actor.ActorCell.handleChildTerminated(ActorCell.scala:749)
at akka.actor.ActorCell.systemInvoke(ActorCell.scala:599)
at akka.dispatch.Mailbox.processAllSystemMessages(Mailbox.scala:191)
at akka.dispatch.Mailbox.run(Mailbox.scala:160)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
I tried the sample run with Akka Actor 2.0, 2.0.1, and 2.0.2-RC1 and it's the same result. Attachments are the short version of the source that I run for the test and evaluation.
Leave a comment
on 2012-06-04 10:49 *
By viktorklang
Milestone set to Mingus
Priority changed from Normal (3) to Highest (1)
Status changed from New to Accepted
on 2012-06-05 03:25 *
By viktorklang
Hi,
you really need to minimize this example so it's easy for me to create a test from.
Right now there are a lot of weird things like shutting down the system inside the constructor of the actor etc.
you really need to minimize this example so it's easy for me to create a test from.
Right now there are a lot of weird things like shutting down the system inside the constructor of the actor etc.
I attached a new file which contains a complete Maven-based project and a couple of bash scripts to run it. It also seems that trying to more simplify the code has resolved the issue. So, I think this issue could be closed or rejected. But before that I'd be happy to have any comments or feedback on the code now. Thanks.
You'd be better off asking for a review on the mailinglist, my time is my most precious resource and I need t ospend it fixing bugs or implementing features.
Cheers,
√
Cheers,
√