add debug helper for CallingThreadDispatcherModelSpec, see #2821

- the problem is that the user guardian gets blocked for more than 3
  seconds, and I have no clue who blocks it where
- therefore print all stack traces two seconds into the test if still
  not finished
This commit is contained in:
Roland 2013-01-20 21:13:19 +01:00
parent c8779f4e9d
commit 00a39232cc
2 changed files with 11 additions and 2 deletions

View file

@ -420,12 +420,21 @@ abstract class ActorModelSpec(config: String) extends AkkaSpec(config) with Defa
val f5 = try { a ? Interrupt } catch { case ie: InterruptedException Promise.failed(new ActorInterruptedException(ie)).future } val f5 = try { a ? Interrupt } catch { case ie: InterruptedException Promise.failed(new ActorInterruptedException(ie)).future }
val f6 = a ? Reply("bar2") val f6 = a ? Reply("bar2")
val c = system.scheduler.scheduleOnce(2.seconds) {
import collection.JavaConverters._
Thread.getAllStackTraces().asScala foreach {
case (thread, stack)
println(s"$thread:")
stack foreach (s => println(s"\t$s"))
}
}
assert(Await.result(f1, remaining) === "foo") assert(Await.result(f1, remaining) === "foo")
assert(Await.result(f2, remaining) === "bar") assert(Await.result(f2, remaining) === "bar")
assert(Await.result(f4, remaining) === "foo2") assert(Await.result(f4, remaining) === "foo2")
assert(intercept[ActorInterruptedException](Await.result(f3, remaining)).getCause.getMessage === "Ping!") assert(intercept[ActorInterruptedException](Await.result(f3, remaining)).getCause.getMessage === "Ping!")
assert(Await.result(f6, remaining) === "bar2") assert(Await.result(f6, remaining) === "bar2")
assert(intercept[ActorInterruptedException](Await.result(f5, remaining)).getCause.getMessage === "Ping!") assert(intercept[ActorInterruptedException](Await.result(f5, remaining)).getCause.getMessage === "Ping!")
c.cancel()
} }
} }

View file

@ -212,7 +212,7 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl,
} else if (!queue.offer(msg)) { } else if (!queue.offer(msg)) {
system.eventStream.publish(Warning(self.path.toString, getClass, "dropping message of type " + msg.message.getClass + " due to enqueue failure")) system.eventStream.publish(Warning(self.path.toString, getClass, "dropping message of type " + msg.message.getClass + " due to enqueue failure"))
system.deadLetters ! DeadLetter(msg.message, msg.sender, self) system.deadLetters ! DeadLetter(msg.message, msg.sender, self)
} } else if (Mailbox.debug) println(s"$self temp queueing ${msg.message} from ${msg.sender}")
} finally lock.unlock() } finally lock.unlock()
} else { } else {
system.eventStream.publish(Warning(self.path.toString, getClass, "dropping message of type" + msg.message.getClass + " due to lock timeout")) system.eventStream.publish(Warning(self.path.toString, getClass, "dropping message of type" + msg.message.getClass + " due to lock timeout"))
@ -243,7 +243,7 @@ private[akka] class UnstartedCell(val systemImpl: ActorSystemImpl,
if (!wasEnqueued) { if (!wasEnqueued) {
system.eventStream.publish(Warning(self.path.toString, getClass, "dropping system message " + msg + " due to enqueue failure")) system.eventStream.publish(Warning(self.path.toString, getClass, "dropping system message " + msg + " due to enqueue failure"))
system.deadLetters ! DeadLetter(msg, self, self) system.deadLetters ! DeadLetter(msg, self, self)
} } else if (Mailbox.debug) println(s"$self temp queueing system $msg")
} }
} finally lock.unlock() } finally lock.unlock()
} else { } else {