[omniORB] ServantActivator, etherealize, lastInvocationHasCompleted and omniObjTableEntry

Mike Harris mike_harris@filemaker.com
Thu Aug 8 18:28:02 2002

omniORB 4.0

I have a situation where in the omniOrbPOA::lastInvocationHasCompleted() 
function the omniObjTableEntry::downcast() call returns 0.

The environment:
A ServantActivator is activated on the RootPOA.  The ServantActivator is 
registered with set_servant_manager on a childPOA created with 
USE_SERVANT_MANAGER and RETAIN policies.  I create an object on that 
childPOA and activate it manually.  I can see that the object is added to 
the omniObjTable.  I use the object, then invoke its "Destroy" method 
which cleans itself up and then calls childPOA->deactivate_object().  
Etherealizing is postponed and the call stack starts retreating (The 
object was used in the same address space.)  The omniLocalIdentity 
destructor is called which in turn calls the lastInvocationHasCompleted() 
function.  At this point an assert on the entry pointer fails.  Apparently 
some mutexs are not released either, as the next locateRequest crashes the 
application by trying to lock a mutex already held.

My etherealize method ( which has yet to be called ), simply reduces the 
ref count.

The service implementation memory has not been deleted at this point.

According to Advanced CORBA Programming in C++, on page 474, the 
etherealize function should be "... invoked in response to an explicit 
object deactivation via deactivate_object ( even if the servant for that 
object was not created by the servant activator )... "  This object was 
manually created and activated, since I need to pass it more information 
than what is obtained during the incarnate function.

Perhaps I'm going about the whole process of trying to free resources 
correctly.  I want to release the server side memory associated with this 
object when the object is no longer in use, ie, the client has invoked a 
"Destroy" method on the object.  This is the reason that I'm using the 
ServantActivator, so that the etherealize method will be called and my 
application can go about freeing memory.

The platform, MacOS X 10.1.5, omniORB compiled with Metrowerks Codewarrior 

Thanks in advance,

Mike Harris
Software Engineer
FileMaker, Inc.