[omniORB] Server Side Garbage Collection

Stefan Seefeld seefelds@MAGELLAN.UMontreal.CA
Mon, 16 Oct 2000 19:13:55 -0400


jiwils - Jimmy Wilson wrote:

[...]

> My problem is what happens when the client "forgets" to invoke B::Release().
> This really causes a memory leak on the server-side.  Or, what happens when
> the client machine is accidentally rebooted in the middle of a request?
> Either scenario adversely impacts the server.
> 
> Is there a CORBA standard way to take care of this problem?  Should the
> factory server implementation implement some kind of reference counting
> system?  Or is there another method to use to avoid this type of problem.

there is no standard way to deal with that problem. Reference counting doesn't
help as it would need the client's cooperation, which is what you want the
server to protect from.

We have a similar situation in the berlin server. A bunch of factory objects
('kits') create objects on behalf of the client. Some of these objects are
ref counted (with explicit IDL methods to acomplish this), some have a 'destroy'
method like the one you propose.

However, for failure of all this we have this:
The first object the client creates in the server is a 'ServerContext', some
form of 'session' object. It performs a ping to the client whenever it wants
(normally in regular intervals). If the ping fails, the client's connection is
down which means the server should free all client resources. To make this
efficient, we use a POA-per-client aproach, i.e. the POA(s) associated with
the client are destructed. They take down all the objects with them. And finally,
as all our servants are derived from PortableServer::RefCountServantBase, which means
that the object's deactivation will trigger the servant's destruction.
This approach works nicely and efficiently, the trick to use POAs on a per client
basis avoids the need to have extra bookkeeping (the POA's Active Object Map is
all we need...)

Hope this helps,	Stefan

_______________________________________________________              
              
Stefan Seefeld
Departement de Physique
Universite de Montreal
email: seefelds@magellan.umontreal.ca

_______________________________________________________

      ...ich hab' noch einen Koffer in Berlin...