system.actorOf(SpringExtProvider.get(system).props("CountingActor"), "counter");
public ActorRef createActorRef(String actorBeanName, String actorRouterName) { ActorRef actor = null; final scala.Option<ActorRef> child = context().child(actorRouterName); if (child != null && child.isDefined()) { actor = child.get(); } else { actor = getContext().actorOf(SpringExtProvider.get(system).props(actorBeanName).withRouter(new FromConfig()), actorRouterName); }}
public abstract class MyActor extends UntypedActor {
private static AtomicInteger instantiationCount = new AtomicInteger(0);
public MyActor() { logger.info("ACTOR CREATED. Instantiation count {}", instantiationCount.getAndIncrement());
}
@Override protected void finalize() { logger.info("ACTOR FINALIZED. Instantiation count {}", instantiationCount.getAndDecrement()); }}
Hi Mark,
Where are you stopping your actors?
--
Cheers,
√
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email to akka-user+...@googlegroups.com.
To post to this group, send email to akka...@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.
If you create new actors continually and never stop any of them then you have by design got a leak.
--
Cheers,
√
if (child != null && child.isDefined()) { actor = child.get();}
I don't know how your app works or what router config you are using so it is impossible for me to know what's happening.
Perhaps you have Restarts happening which will create new MyActor instances but the old instances are still reachable by something else. Spring perhaps?
Use a memory debugger and trace the reachability of those MyActor instances.
--
Cheers,
√
/myActor/ { dispatcher = my-pinned-dispatcher router = round-robin nr-of-instances = 10
}
public sendAkkaMessage(String actorBeanName, String actorRouterName, Object message) {
ActorRef actor = null; final scala.Option<ActorRef> child = context().child(actorRouterName); if (child != null && child.isDefined()) { actor = child.get(); } else { actor = getContext().actorOf(SpringExtProvider.get(system).props(actorBeanName).withRouter(new FromConfig()), actorRouterName);
}
actor.tell(message, self());}
Patrik Nordwall
Akka Tech Lead
Lightbend - Reactive apps on the JVM
Twitter: @patriknw
/rootActor { ...}
/rootActor/myActor1 { ...}
/rootActor/myActor1/myActor2 { ...}
/rootActor/myActor1/myActor2/myActor1 { ...}
14 juni 2016 kl. 16:28 skrev Mark Kaberman <mkab...@gmail.com>:Hi Roland,As I wrote in my original post my application traverses the tree. The depth of the three is small and the paths are known in advance, but the breath is very large. So I have relatively small number of actors (and actorRouterName ) arguments
21 juli 2016 kl. 18:39 skrev Mark Kaberman <mkab...@gmail.com>:I was able to write a test app which reproduces the problem (attached). Based on the application.conf I would expect 65 instances of the actors to be created. When I start my actors (by executing POST request to http://localhost:8080/start with no body) I see 385 instances created. Which each sequential request extra 385 instances are added until the system runs out of memory.
<AkkaDemo.zip>
/someActor { router = round-robin-pool nr-of-instances = 10}
actor = getContext().actorOf(SpringExtProvider.get(system).props(actorBeanName).withRouter(new FromConfig()), actorRouterName);
[ERROR] [07/22/2016 13:02:14.136] [AkkaDemo-akka.actor.default-dispatcher-3] [akka://AkkaDemo/user/rootActor] configuration problem while creating [akka://AkkaDemo/user/rootActor/$a/actor2] with router dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox] and routee dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox]akka.ConfigurationException: configuration problem while creating [akka://AkkaDemo/user/rootActor/$a/actor2] with router dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox] and routee dispatcher [akka.actor.default-dispatcher] and mailbox [akka.actor.default-mailbox] at akka.actor.LocalActorRefProvider.actorOf(ActorRefProvider.scala:797) at akka.actor.dungeon.Children$class.makeChild(Children.scala:273) at akka.actor.dungeon.Children$class.actorOf(Children.scala:42) at akka.actor.ActorCell.actorOf(ActorCell.scala:374) at org.mark.demo.BaseActor.sendMessage(BaseActor.java:67) at org.mark.demo.RootActor.onReceive(RootActor.java:38)Enter code here...