TypedActorConfigurator.stop() does not release the actors its holding

23 views
Skip to first unread message

gutzeit

unread,
Feb 9, 2011, 12:59:40 PM2/9/11
to akka...@googlegroups.com
Hi,

- I have a pool of TypedActorConfigurator(s) and each configurator hold and responsible for actor type. I can have multiple TypedActorConfigurator in the pool (using apache commons pool). When there is starvation, new configurators are being created and released when not needed.

- When TypedActorConfigurator is no longer needed I destroy it by calling "configurator.stop();"

- Each actor has an instance of mongodb connection. MongoDB connections are released when being garbage collected.

What I see is that mongo connections are never being released, which means that "stop()" method of configurator does not stop the actors and does not release them.

Is there an issue with it ? Am I missing something ?

Thanks in advance.

√iktor Klang

unread,
Feb 9, 2011, 1:10:00 PM2/9/11
to akka...@googlegroups.com

Configurator.stop only shuts down the supervisor, so if you aren't supervising your actors then that might explain it.


Impl:

  def stop = synchronized {
    if (supervisor.isDefined) supervisor.get.shutdown
  }
 

Thanks in advance.

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
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.



--
Viktor Klang,
Code Connoisseur
Work:   Scalable Solutions
Code:   github.com/viktorklang
Follow: twitter.com/viktorklang
Read:   klangism.tumblr.com

gutzeit

unread,
Feb 9, 2011, 2:46:15 PM2/9/11
to akka...@googlegroups.com
So what would be the correct way of fully disposing configurator with its actors ? (In javaish ...)

√iktor Klang

unread,
Feb 9, 2011, 2:54:10 PM2/9/11
to akka...@googlegroups.com
On Wed, Feb 9, 2011 at 8:46 PM, gutzeit <gut...@gmail.com> wrote:
So what would be the correct way of fully disposing configurator with its actors ? (In javaish ...)

Does this help? : TypedActor.stop(typedActor)
 

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
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.

Roma Goldberg

unread,
Feb 15, 2011, 2:26:45 AM2/15/11
to akka...@googlegroups.com
Hi,

I also use akka in a java environment and i have pretty much the same actor configuration as gutzeit.
I am closing my actors as suggested above.

I ran a profiler and i noticed that even after i stop an actor, an instance of that actor still lingers in the memory.
For each actor that i open and close i get a new instance of the actor class just sitting in the memory.
From the profiler i can see that akka.actor.AspectInitRegistry is the object that holds the reference to the actor instance.

I assumed that after i close an actor its instance should be GC.
Any idea how can i get rid of those instances in the akka.actor.AspectInitRegistry?

Thanks in advance
Roma.


Martin Krasser

unread,
Feb 15, 2011, 9:06:13 AM2/15/11
to akka...@googlegroups.com
Hi Roma,

I cannot reproduce the problem you reported. For example,

val actor = TypedActor.newInstance(classOf[MyTypedActor],
classOf[MyTypedActorImpl]) // adds actor to AspectInitRegistry
TypedActor.stop(actor) // removes actor from AspectInitRegistry

properly adds and removes the typed actor from the AspectInitRegistry.
The typed actor is also removed from akka.actor.Actor.registry (as
expected). Please share some code that demonstrates the problem.

Thanks,
Martin

Am 15.02.11 08:26, schrieb Roma Goldberg:

> --
> You received this message because you are subscribed to the Google
> Groups "Akka User List" group.
> 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.

--
Martin Krasser

blog: http://krasserm.blogspot.com
code: http://github.com/krasserm
twitter: http://twitter.com/mrt1nz

Roma Goldberg

unread,
Feb 15, 2011, 9:16:43 AM2/15/11
to akka...@googlegroups.com
Hi Martin,

I am using TypedActorConfigurator to get an instance of an actor.

So my way of acquiring an actor is:

TypedActorConfigurator actorConfigurator = (TypedActorConfigurator) aConfigurator;
StoreAccess actor = actorConfigurator.getInstance(StoreAccess.class);

Where StoreAccess extends TypedActor of course.

Thanks in advance
Roma.


Martin Krasser

unread,
Feb 15, 2011, 9:35:02 AM2/15/11
to akka...@googlegroups.com
ok good ... and how do you stop the actors?

A small running example would be very helpful.

Thanks,
Martin

Am 15.02.11 15:16, schrieb Roma Goldberg:

Roma Goldberg

unread,
Feb 15, 2011, 10:48:05 AM2/15/11
to akka...@googlegroups.com
Hi Martin,

While writing the example i found a stupid bug in my code.
Everything works fine now.

Thanks for the fast response :)

Martin Krasser

unread,
Feb 15, 2011, 10:57:59 AM2/15/11
to akka...@googlegroups.com

Am 15.02.11 16:48, schrieb Roma Goldberg:


> Hi Martin,
>
> While writing the example i found a stupid bug in my code.
> Everything works fine now.

Great, happy hAkking!

>
> Thanks for the fast response :)

Reply all
Reply to author
Forward
0 new messages