Marcin Raczkowski
1/24/2008 5:49:00 AM
Aaron Turner wrote:
> Hopefully the below makes sense...
>
> My DRb server's front object has a method called 'create_foo' which
> creates & returns a new instance of class Foo. The Foo class must
> keep track of the number of active Foo objects and enforces a limit.
> Well behaved clients call my_foo_obj.free before releasing their
> reference to my_foo_obj which updates the Foo class tracker. Of
> course, not all clients are well behaved (they crash, user CTRL-C's
> them, server they're on get rebooted, etc). The result is that stale
> objects stay around indefinitely and are never marked as released in
> the Foo class. Foo class leaks objects and ends up stoping creating
> new ones.
>
> I've tried creating a Foo.finalizer method which does the free(), but
> that doesn't work, even when I force garbage collection. Both the
> front object and Foo class are DRbUndumped.
>
> Anyways, it would be great if there was a way for the DRb server to
> detect a client has disconnected and react accordingly, but I can't
> find any way to hook into the DRb class to do that. Suggestions?
>
It's problem with both GC and DRb.
finilizer will never be run becouse it's run just before object is
collected - since DRb is not releasing reference it's newer collected.
try using object proxy (delegator)