[omniORB] resolve_initial_references and ref counting : bug ?
Brecht Vermeulen
brecht.vermeulen@rug.ac.be
Wed, 17 Oct 2001 01:26:10 +0200
Hi all,
I spent some time searching for non-released object references in my
code (omni4 says '2 object references present at ORB shutdown' with
ORBtraceLevel 15) and I think the reference returned by
resolve_initial_references("Nameservice") is badly counted :
(I tested the behaviour with omni4 because the debugging output is
better, but as far as I have tested, I think omni3.0.4 is also affected
(omni4 was the version of 2nd October):
If you assign it to a _var (in bindObjectToName), then it is not
released when the _var goes out of scope. If you however assign it to a
_ptr and do a CORBA::release 2 (!!) times, then it is released ! (and I
get
omniORB: 0 object references present at ORB shutdown.
omniORB: ORB shutdown is complete.
Segmentation fault
Only if you release it 3 times, you get 'CORBA::release() may have been
called too many times on an object
reference.'
I think this is a bug with the reference counting or am I doing
something wrong ?
Things are tested with the eg3 example, where I commented out the line
orb->run in the code to have an immediate shutdown & clean up:
Output in omni4: (I added now the ---- lines with a little comment)
omniORB: Distribution date: Wed Sep 26 11:44:50 BST 2001 sll
omniORB: Native char code sets: ISO-8859-1 UTF-8.
omniORB: Transmission char code sets: ISO-8859-1(1.2) ISO-8859-1(1.1)
ISO-8859-1(1.0) UTF-8(1.2).
omniORB: Native wide char code sets: UTF-16.
omniORB: Transmission wide char code sets: UTF-16(1.2).
omniORB: Information: the omniDynamic library is not linked.
omniORB: Initialising incoming endpoints.
omniORB: Starting serving incoming endpoints.
omniAsyncInvoker: thread id=1 has started. Total threads = 1
---- activate object
omniORB: Adding root<0> (activating) to object table.
omniORB: State root<0> (activating) -> active
---- _this
omniORB: Creating ref to local: root<0>
target id : IDL:Echo:1.0
most derived id: IDL:Echo:1.0
---- resolve_initial_reference
(also strange, omni4 doesn't mention the most derived id while omni3
does this correctly)
omniORB: Creating ref to remote: key<0x4e616d6553657276696365>
target id : IDL:omg.org/CORBA/Object:1.0
most derived id:
omniORB: Initial reference `NameService' resolved from configuration
file.
omniAsyncInvoker: thread id=2 has started. Total threads = 2
---- _narrow
omniORB: Creating ref to remote: key<0x4e616d6553657276696365>
target id : IDL:omg.org/CosNaming/NamingContext:1.0
most derived id:
omniORB: LocateRequest to remote: key<0x4e616d6553657276696365>
---- alreadybound -> resolve context
omniORB: Creating ref to remote: root/<16777216>
target id : IDL:omg.org/CORBA/Object:1.0
most derived id: IDL:omg.org/CosNaming/NamingContextExt:1.0
---- _narrow
omniORB: Creating ref to remote: root/<16777216>
target id : IDL:omg.org/CosNaming/NamingContext:1.0
most derived id: IDL:omg.org/CosNaming/NamingContextExt:1.0
omniORB: omniRemoteIdentity deleted.
---- deletion of the last two created refs to Namingcontexts
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContextExt:1.0) -- deleted.
omniORB: LocateRequest to remote: root/<16777216>
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContextExt:1.0) -- deleted.
---- deletion of the narrowed Naming Service Naming context
omniORB: ObjRef() -- deleted.
omniORB: Preparing to shutdown ORB.
omniORB: Destroying POA(RootPOA).
omniORB: Deactivating all POA(RootPOA)'s objects.
omniORB: State root<0> (active) -> deactivating
omniORB: Waiting for requests to complete on POA(RootPOA).
omniORB: Requests on POA(RootPOA) completed.
omniORB: State root<0> (deactivating) -> etherealising
omniORB: Etherealising POA(RootPOA)'s objects.
omniORB: Removing root<0> (etherealising) from object table
omniORB: RefCountServantBase has zero ref count -- deleted.
omniORB: Stopping serving incoming endpoints.
omniORB: Destruction of POA(RootPOA) complete.
omniORB: Shutting-down all incoming endpoints.
omniORB: omniRemoteIdentity deleted.
omniORB: Object table entry root<0> (dead) deleted.
omniORB: 2 object references present at ORB shutdown.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
omniORB: ORB shutdown is complete.
---- so, this is the the reference returned by
resolve_initial_references("Nameservice"), I think, although it is
already gone out of scope a lot earlier
omniORB: ObjRef() -- deleted.
omniORB: 1 remaining rope deleted.
omniAsyncInvoker: thread id=1 has exited. Total threads = 1
omniAsyncInvoker: thread id=2 has exited. Total threads = 0
----- the local reference (obj -> _var)
omniORB: ObjRef(IDL:Echo:1.0) -- deleted.
omniORB: No more references to the ORB -- deleted.
omniORB: Final clean-up
omniORB: Deleted 2 nil object references and 0 other tracked objects.
omniORB: Final clean-up completed.
best regards,
Brecht