we might have discovered a problem with top-level actor creation, but I'd like to get your opinion on things before filing an issue:
When you quickly create a large number of top-level actors it appears as if the blocking `Await.result` calls in the `actorOf` implementations of `ActorSystemImpl` can hog _all_ available threads in the underlying dispatcher thereby starving the guardian of the execution resources required to actually perform the actor creation.
Check out this example:
object Main extends App {
implicit val system = ActorSystem()
val n = 100
println("Creating " + n + " actors in parallel ...")
Future.traverse((0 to n).toList) { i =>
Future(system.actorOf(Props(ctx => { case _ => })))
} onComplete { result =>
println(result.fold("Error: " + _, _ => "Finished ok"))
system.shutdown()
}
}
On my machine, on Akka 2.0.1 with the default config, this example will block for 20 seconds before coming back with an future timeout error.
When you reduce n to 10 everything works as expected.
The problem only appears with top-level actors, moving creation on level down from the ActorSystem into an ActorContext prevents the deadlock.
We can't seem to find any mechanism in the current code preventing the described starvation, so it might be a design choice or an omission.
Looking forward to your feedback on this!
Cheers,
Mathias
> To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/BEqH9HrmezwJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.
Hi,even if this will be resolved in the next version, we've hit the problem again: With the current implementation (< 2.1) Agents suffer from the same problem because they are always created directly under the ActorSystem so that concurrent creation of too many Agents will first lock and then eventually lead to timeouts.Maybe the context should be configurable for Agents as well so that they can be created under actors as well.
Johannes
On Monday, April 23, 2012 12:30:40 PM UTC+2, rkuhn wrote:fixed in release-2.0 and master, thanks for reporting!
--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/IZjXrJuv5UoJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.