Take the 2-minute tour ×

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?

The most helpful code snippets in this application can be:

The search method in each Node to ask peers for a search query and return results

  def search(query: String): Collection[String] = {
    var result: List[String] = List[String]()
    this.list().toList.foreach { q =>
        if (q.contains(query)) {
            result = query :: result
    implicit val timeout = Timeout(1 hour)
    // println("[" + this + "]'s peers: " + peers)
    for (p <- peers) {
      // println("asking [" + p + "] for [" + query + "]")
      val tmp: Future[Collection[String]] = ask(p.asInstanceOf[ActorRef], _search(query)).mapTo[Collection[String]]
      val l = Await.result(tmp, timeout.duration).asInstanceOf[Collection[String]]
      l.toList.foreach { q =>
        if (q.contains(query)) {
            result = q :: result

The snippet in the main section to evaluate a network of nodes:

import context.dispatcher
var start = System.currentTimeMillis
val futures = List.fill(querySize)(ask(root, _search("_" + r.nextInt(100))).mapTo[Collection[String]])
val results = Future.sequence(futures)
Await.ready(results, Timeout(1000 hour).duration)
var end = System.currentTimeMillis
share|improve this question
Open a ticket with a reproducible testcase, because I assume you have tested this against 2.0.2-RC1 –  Viktor Klang Jun 1 '12 at 12:03
I'm using Akka Actor 2.0 and Scala 2.9.1 –  nobeh Jun 1 '12 at 12:14
So try 2.0.2-RC1 before opening the ticket. Thanks –  Viktor Klang Jun 1 '12 at 12:29
Not working on 2.0, 2.0.1, and 2.0.2-RC1. Created ticket #2170. –  nobeh Jun 1 '12 at 14:35
Great, thanks!! –  Viktor Klang Jun 1 '12 at 15:25
add comment


Your Answer



Browse other questions tagged or ask your own question.