[omniORB] problem with _dispose()

Sai-Lai Lo S.Lo@orl.co.uk
Mon, 20 Apr 1998 17:24:36 +0100


>>>>> Fredrik Jonsson writes:

>> Has anyone got an idea ??

> Maybe:

> Sequence of operation stopping an implementation object:

> unbindobjectname(x);		// your own unbinding
> boaptr-> deactivate_obj(x);	// stop handling further requests
> x-> _dispose();		// "release" the implementation
> 				// object

> Adding unbinding and deactivation in the destructor is a convenient
> programming style. Calling x->_dispose() automatically invokes
> the destructor, thus cleaning up properly. The reason for your crash
> must be the missing deactivate_obj(), (if I'm not completely wrong)

Be careful, there is no deactivate_obj() in the BOA of omniORB2. I think it
is important to stress again that different vendors implement BOA in
different ways, making it effectively a proprietary interface.

> The reason for destructor not being called: there are still references
> locally on the server side. I.e. you probably used _narrow(), _this()
> in other places where it wasn't a return value, and forgot to
> CORBA::release() them, I guess.

Yes. This is the reason.

> I dont know what the Corba spec says, but my own tests shows
> that the object_ptr reference counter prevents deletion of service
> object only on the server side, in the server process. Remote
> processes reference counters does not prevent the service from
> being removed, generating an exception when they are used
> instead. (It makes sense in my opinion). I.e. if you keep a
> object_ptr to "your self" in the implementation, dispose() doesn't
> delete the object until the last reference is released, (ref count 0).

Yes, this is documented in section 5.3 in the user guide. This difference
in semantics between a remote and a colocated object will be removed in
future releases.