[omniORB] strange asymmetric behavior

baileyk at schneider.com baileyk at schneider.com
Mon Jul 21 14:00:24 BST 2003


I didn't expect your production code.  A typical approach to solving a
problem like this is to write a very small test case.  If you do that (and
I know it can be a pain sometimes) then you'd likely get your answers from
this list in short order -- either a verified bug or an explanation for the
behavior.

I've seen plenty of advice against using _this() at all.  It is easy to
activate a new object in the root POA, incarnated by the servant, without
meaning to.  Just ask yourself how a servant is supposed to know what
object reference you mean when you ask for _this()?  The servant objects
don't magically know about the POAs and servant managers, or even the
object IDs of the CORBA objects they incarnate.  A servant can incarnate
multiple CORBA objects at once, so _this() should really be used in only
very special circumstances: when one knows the servant only incarnates a
single CORBA object, and then one should always override _default_POA() to
return the right POA.  Of course, inside an upcall, _this() is much better
behaved.  Within the context of an upcall on a CORBA object, _this() called
on the incarnating servant should return a reference to object being
invoked.

So I think your solution is to stop using _this().  Keep track of the CORBA
object references in addition to the servant object references, or use the
POA methods ( id_to_reference(), etc...) to generate CORBA object
references from the persistent IDs on the fly as needed.

Kendall




                                                                                                                                         
                      "Renzo Tomaselli"                                                                                                  
                      <renzo.tomaselli at tecnotp.it>         To:       "Omniorb list" <omniorb-list at omniorb-support.com>                   
                      Sent by:                             cc:                                                                           
                      omniorb-list-bounces at omniorb-        Fax to:                                                                       
                      support.com                          Subject:  Re: [omniORB] strange asymmetric behavior                           
                                                                                                                                         
                                                                                                                                         
                      07/21/2003 12:21 PM                                                                                                
                                                                                                                                         
                                                                                                                                         




Kendall,
    fetching a code slice is somewhat problematic since the overall
architecture is pretty complex.
In short, the involved servant is a persistent object which represents a
whole DLL. It is managed through a servant activator in a specific POA
(PERSISTENT, USER_ID, USE_SERVANT_MANAGER). This object represents a
service
to be loaded on demand (a factory). We have several of them and they are
operational since a few years without any problem.
A specific infrastructure takes them up and down on demand.
Now I needed to pass an obj ref of one such servant along with a method
invoked out of any servant upcall, although being in the server (service)
code. So I took _this() on it, then I noticed that the loading
infrastructure could not delete the servant because of its refcount being 2
at deactivation time (sometimes).
Then I noticed that this refcount goes sometimes up by one as a side effect
of taking _this(), depending of servant history (e.g. current activations,
see ServantBase::_do_this() ).
It's somewhat difficoult for the method which invokes _this() to determine
if _remove_ref() should be called afterwards or not. I expected that this
would be done by the symmetric local operation, e.g. destroying the obj
ref.
I'm actually very confused about why taking _this() out of any upcall
should
activate the object again.
Thanks,

Renzo

----- Original Message -----
From: <baileyk at schneider.com>
To: "Renzo Tomaselli" <renzo.tomaselli at tecnotp.it>
Cc: "Omniorb list" <omniorb-list at omniorb-support.com>
Sent: Monday, July 21, 2003 6:19 PM
Subject: Re: [omniORB] strange asymmetric behavior


>
> Just a guess, but since you've posted no code I'll offer it.  If your
> servant has not overridden the _default_poa method, you may be activating
> it a second time in the root POA without intending to.  If you've
activated
> in a POA other than the root, and later call _this() outside the context
of
> an upcall, then the additional activation in the root POA is what's
causing
> the reference count to go up.  If so, there's no leak since the root POA
> will release these references when the ORB is shut down.
>
> If you post a complete example including source for the servant perhaps
we
> can track down what's going on.
>
> Kendall




_______________________________________________
omniORB-list mailing list
omniORB-list at omniorb-support.com
http://www.omniorb-support.com/mailman/listinfo/omniorb-list








More information about the omniORB-list mailing list