[omniORB] NameService & bidir

Slava Garelin garelin@ukr.net
Wed Jun 19 10:23:00 2002


On Tuesday 18 June 2002 11:23, Duncan Grisby wrote:
> On Thursday 13 June, Slava Garelin wrote:
> > In case of call to NameService and placed bidir connection rule I by call
> > orb-> shutdown () have "Client connection refcount = 1" and break.
>
> What exactly are you doing, and what goes wrong?  Please post a code
> fragment, and the trace with -ORBtraceLevel 25.

Hi, Duncan.
If I start the ./server -ORBclientTransportRule '^* unix,tcp,ssl' 
-ORBtraceLevel 25 
then I see the following: 

Log:================
(Skipped)

 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:OffClub_Trade/Gamma_GammaDb/Database:1.0
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef(IDL:OffClub_Trade/Gamma_GammaDb/Database:1.0) -- deleted.
omniORB: Preparing to shutdown ORB.
omniORB: Destroying POA(RootPOA).
omniORB: Deactivating all POA(RootPOA)'s objects.
omniORB: Waiting for requests to complete on POA(RootPOA).
omniORB: Requests on POA(RootPOA) completed.
omniORB: Etherealising POA(RootPOA)'s objects.
omniORB: Stopping serving incoming endpoints.
omniORB: giopServer waits for completion of rendezvousers and workers
omniORB: Destruction of POA(RootPOA) complete.
omniORB: Shutting-down all incoming endpoints.
omniORB: TCP endpoint shut down.
omniORB: Disable ObjRef(IDL:omg.org/CosNaming/NamingContextExt:1.0) 
key<0x4e616d
6553657276696365>
omniORB: omniRemoteIdentity deleted.
omniORB: 1 object reference present at ORB shutdown.
omniORB: ORB shutdown is complete.
omniORB: ObjRef(IDL:omg.org/CosNaming/NamingContextExt:1.0) -- deleted.
omniORB: Deinitialising omniDynamic library.
omniORB: Client connection refcount (forced) = 0
omniORB: Client close connection to giop:tcp:192.168.111.20:2809
omniORB: 1 remaining rope deleted.
omniORB: AsyncInvoker: thread id = 2 has exited. Total threads = 2
omniORB: AsyncInvoker: thread id = 1 has exited. Total threads = 1
omniORB: AsyncInvoker: deleted.
omniORB: No more references to the ORB -- deleted.
omniORB: Final clean-up
omniORB: Released 248 static TypeCodes.
omniORB: Deleted 2 nil object references and 2 other tracked objects.
omniORB: Final clean-up completed.
=====================

If I start   ./server -ORBclientTransportRule '^* bidir,unix,tcp,ssl' 
-ORBtraceLevel 25

Log:================
(Skipped)
 target id      : IDL:omg.org/CORBA/Object:1.0
 most derived id: IDL:OffClub_Trade/Gamma_GammaDb/Database:1.0
omniORB: omniRemoteIdentity deleted.
omniORB: ObjRef(IDL:OffClub_Trade/Gamma_GammaDb/Database:1.0) -- deleted.
omniORB: AsyncInvoker: thread id = 4 has started. Total threads = 4
d
omniORB: Preparing to shutdown ORB.
omniORB: Destroying POA(RootPOA).
omniORB: Deactivating all POA(RootPOA)'s objects.
omniORB: Waiting for requests to complete on POA(RootPOA).
omniORB: Requests on POA(RootPOA) completed.
omniORB: Etherealising POA(RootPOA)'s objects.
omniORB: Stopping serving incoming endpoints.
omniORB: giopServer waits for completion of rendezvousers and workers
omniORB: throw giopStream::CommFailure from 
giopStream.cc:812(0,NO,COMM_FAILURE_UnMarshalArguments)
omniORB: Client connection refcount = 1
=====================
And unlimited waiting...

server's code:

int main(int argc, char** argv)
  
{ 
omniORB::logger log("MyNotifyClient: ");
  try {
    // Initialise the ORB.
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv, "omniORB4");

    // Obtain a reference to the root POA.
    CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
    PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);   
//------- resolve Database object
{
    CosNaming::Name DatabaseName;
    DatabaseName.length(3);
    DatabaseName[0].id   = (const char*) "OffClub_Trade";   // string copied
    DatabaseName[0].kind = (const char*) "Module"; // string copied

    DatabaseName[1].id   = (const char*) "Gamma_GammaDb";   // string copied
    DatabaseName[1].kind = (const char*) "Module"; // string copied

    DatabaseName[2].id   = (const char*) "Database";   // string copied
    DatabaseName[2].kind = (const char*) "Object"; // string copied
    ORBA::Object_var obj1 = GetObjectReference_(orb,DatabaseName);

}
    PortableServer::POAManager_var pman = poa->the_POAManager();
    pman->activate();


    char c='n';

    orb->destroy();
  }

...
(catch block skipped)

  return 0;
}

CORBA::Object_ptr GetObjectReference_(CORBA::ORB_ptr orb,
                                                        CosNaming::Name Name){

  CosNaming::NamingContext_var rootContext;
  
  try {
    // Obtain a reference to the root context of the Name service:
    CORBA::Object_var obj;
      obj = orb->resolve_initial_references("NameService");

    // Narrow the reference returned.
    rootContext = CosNaming::NamingContext::_narrow(obj);
    if (CORBA::is_nil(rootContext)){
      cerr << "Failed to narrow the root naming context.\n";
      return CORBA::Object::_nil();
    }
  }  
  catch(CORBA::ORB::InvalidName&) {
    // This should not happen!
    cerr << "Service required is invalid [does not exist].\n";

    return CORBA::Object::_nil();
  }
  // Create a name object, containing the name test/context:
  try {
    // Resolve the name to an object reference.
    return rootContext->resolve(Name);
  }
...
(catch block skipped)
   
  return CORBA::Object::_nil();
}



-- 
Slava Garelin