It does not. 

On Tuesday, June 14, 2016 at 8:14:20 AM UTC-4, √ wrote:
>
> Is supervision triggering? (i.e. restarts, possibly creating new beans)?
>
> On Tue, Jun 14, 2016 at 2:03 PM, Mark Kaberman <mkab...@gmail.com 
> <javascript:>> wrote:
>
>> I added the static instantiation counter to my actor Spring bean (see my 
>> original post). When an actor is created via getContext().ActorOf(... I see 
>> number of logging entries coming from the bean's constructor indicating 
>> that n instances of the actor beans has been created where n matches 
>> nr-of-instances from my Akka config. When context().child.(..).get() is 
>> called, I see a single logging entry coming from bean's constructor 
>> indicating that a singe actor bean has been created. My logging indicates 
>> that  getContext().ActorOf(.. is only called once per actor, 
>> but context().child.(..).get()  is called constantly (as it should). So I 
>> see ever increasing counter logging indicating that more and more Spring 
>> beans are created.
>>
>>
>> On Tuesday, June 14, 2016 at 7:38:37 AM UTC-4, Patrik Nordwall wrote:
>>>
>>> I'm 100% sure that the child.get method here doesn't create an actor. 
>>> How do you see that?
>>>
>>> On Fri, Jun 10, 2016 at 10:43 PM, Mark Kaberman <mkab...@gmail.com> 
>>> wrote:
>>>
>>>> I debugged my application and it seems to be a bug in Akka:
>>>>
>>>> My routers are defined similarly to each other as
>>>> /myActor/ {
>>>>   dispatcher = my-pinned-dispatcher
>>>>   router = round-robin
>>>>   nr-of-instances = 10
>>>> }
>>>>
>>>> When I debug into my actor creation and messaging method
>>>>
>>>> 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());
>>>> }
>>>>
>>>> I see that when a new actor is created by calling 
>>>> getContext().actorOf()...  I see 10 new Spring beans being created (as per 
>>>> Akka config). When an actor is created via child.get() I see one Spring 
>>>> bean is created. So it seems that in the case of a get() Akka disregards 
>>>> already created Spring beans and creates one more. 
>>>>  
>>>>
>>>>
>>>> On Friday, June 10, 2016 at 1:24:21 PM UTC-4, √ wrote:
>>>>>
>>>>> 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,
>>>>> √
>>>>> On Jun 10, 2016 6:03 PM, "Mark Kaberman" <mkab...@gmail.com> wrote:
>>>>>
>>>>>> Isn't the code:
>>>>>>
>>>>>> if (child != null && child.isDefined()) {
>>>>>>        actor = child.get();
>>>>>> } 
>>>>>>
>>>>>> supposed to fetch existing actor actor reference instead of creating 
>>>>>> a new one?
>>>>>>
>>>>>> If I call stop() at the end of onReceive() what happens to other 
>>>>>> instances of the same actor which could be processing different 
>>>>>> vertices? 
>>>>>> Will they be shut down as well?
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Friday, June 10, 2016 at 10:48:48 AM UTC-4, √ wrote:
>>>>>>>
>>>>>>> If you create new actors continually and never stop any of them then 
>>>>>>> you have by design got a leak.
>>>>>>>
>>>>>>> -- 
>>>>>>> Cheers,
>>>>>>> √
>>>>>>> On Jun 10, 2016 4:35 PM, "Mark Kaberman" <mkab...@gmail.com> wrote:
>>>>>>>
>>>>>>>> Hi Viktor,
>>>>>>>>
>>>>>>>> I never stop my actors explicitly (except as reaction to failure in 
>>>>>>>> supervision strategy). All actors process the vertex data in 
>>>>>>>> onReceive() 
>>>>>>>> method, determine if a vertex has children, get the children actor by 
>>>>>>>> calling my createActorRef, send the message to a child via tell (never 
>>>>>>>> ask) 
>>>>>>>> and exit onReceive.
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>>
>>>>>>>> Mark
>>>>>>>>
>>>>>>>>
>>>>>>>> On Friday, June 10, 2016 at 10:27:25 AM UTC-4, √ wrote:
>>>>>>>>>
>>>>>>>>> Hi Mark,
>>>>>>>>>
>>>>>>>>> Where are you stopping your actors?
>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>>> Cheers,
>>>>>>>>> √
>>>>>>>>> On Jun 10, 2016 2:55 PM, "Mark Kaberman" <mkab...@gmail.com> 
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> I have Akka application which is essentially traverses a very 
>>>>>>>>>> large tree where each vertex processing is done by an individual  
>>>>>>>>>> actor. 
>>>>>>>>>> Different kinds of vertices are processed by different actors. The 
>>>>>>>>>> actors 
>>>>>>>>>> are implemented as prototype Spring beans (they are derived from the 
>>>>>>>>>> same 
>>>>>>>>>> abstract class) and I am using Akka/Spring integration from Akka 
>>>>>>>>>> Spring integration 
>>>>>>>>>> <https://github.com/typesafehub/activator-akka-java-spring>. The 
>>>>>>>>>> only two differences between the githib example and my code is that 
>>>>>>>>>> I use 
>>>>>>>>>> configuration file to configure the routers and the way I get actor 
>>>>>>>>>> references. 
>>>>>>>>>> Since the example only uses one actor it creates it like 
>>>>>>>>>>
>>>>>>>>>> system.actorOf(SpringExtProvider.get(system).props(
>>>>>>>>>> "CountingActor"), "counter");
>>>>>>>>>>
>>>>>>>>>> My actor system is hierarchical and I create my actors differently
>>>>>>>>>>
>>>>>>>>>> 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);
>>>>>>>>>>     }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> When my system is running for few days it runs out of memory. I 
>>>>>>>>>> ran the profiler and discovered that there is a huge number of 
>>>>>>>>>> actor's 
>>>>>>>>>> Spring beans being instantiated. So I instrumented my actors with 
>>>>>>>>>> the 
>>>>>>>>>> instance counters:
>>>>>>>>>>
>>>>>>>>>> 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());
>>>>>>>>>>     }
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> When I run  my application I see constant flow of "ACTOR CREATED" 
>>>>>>>>>> log entries with ever incrementing counter with the finalize() 
>>>>>>>>>> method never 
>>>>>>>>>> called. Eventually after few days of running the system runs out of 
>>>>>>>>>> memory. 
>>>>>>>>>> I am wondering if I am doing something wrong with obtaining the 
>>>>>>>>>> actor 
>>>>>>>>>> references or there is some issues with Akka/Spring integration
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -- 
>>>>>>>>>> >>>>>>>>>> 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.
>>>>>>>>>>
>>>>>>>>> -- 
>>>>>>>> >>>>>>>>>> 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.
>>>>>>>>
>>>>>>> -- 
>>>>>> >>>>>>>>>> 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.
>>>>>>
>>>>> -- 
>>>> >>>>>>>>>> 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.
>>>>
>>>
>>>
>>>
>>> -- 
>>>
>>> Patrik Nordwall
>>> Akka Tech Lead
>>> Lightbend <http://www.lightbend.com/> -  Reactive apps on the JVM
>>> Twitter: @patriknw
>>>
>>> -- 
>> >>>>>>>>>> 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 <javascript:>.
>> To post to this group, send email to akka...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
> 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+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to