[omniORB] Asymmetrical Comm_failure

Aida Fátima Cano aida.cano at gmail.com
Wed Feb 21 11:33:55 GMT 2007


>
> > Then, discconect the network card of PC A, and start process
> > A. This process, every 3 seconds test its TCP conection
> > trying to ping the IP where omninames is running. If the test
> > success (when I reconnect the network card), creates a thread
> > that goes into orb->run(), and (in another thread) poll the process B.
>
> I assume that when process A calls the service in B, it passses in an
> object reference to a servant in process A, right ? Have a look at that
> object reference - I think that you will see that the object reference
> contains an IP address which is localhost.



This is because when you started up process A I assume that you initialized
> the orb before you begin checking for the presence of the network


Firstly I did what you said, but then I saw the local reference so I change
it. I've only start the thread that goes into orb-run() if I have TCP
connection and if the PC in which omninames are running is reachable. It is
what I meant when I said "if the test success".



>If my guesses are correct the problem should be avoidable by either setting
a static IP address of the machine >containing process A (the machine
address is then visible to the orb even when the network is down)

Every PC I use have static IP (only one network card, and only one IP).

Each time I discconect and connect the network while the process are running
the port used is different, but I think this have no importance, right

Is there some way to me of seeing what's happening since proccess A invoques
a method of process B until it reachs the code implementation in proccess B?
I have look the ORB traces, but I don't really understand it.

The code to do this is:
 For process A
     if(ping.Ping("192.168.2.114"))
     {
        hThreadCorba = CreateThread (NULL, NULL, ServerResponse, NULL, 0,
NULL);
     }
     else
        SetTimer(TIMER_CORBA,3003,NULL);

For process B
    if(ping.Ping("192.168.2.114"))
    {
        hThreadCorba = CreateThread (NULL, NULL, HiloCorba, NULL, 0, );
     }
    else
       SetTimer(TIMER_CORBA,3003,NULL);

192.168.2.114 is the static IP of the PC where omninames are running.

Each time a process want something of the other creates a variable:

   try
   {
       ProcessA m_corbaCallOb;
       m_corbaCallOb.methodB();
    }
    catch(CORBA::TRANSIENT& ex)
    {
    }
    catch(...)
    {
    }



And finally, the constructor of ProcessA (is the same to proccess B,
changing the name of the class and the name  used by the CORBA server
when binding to the name server)

CProcessA::CProcessA ()
{
 try {

//------------------------------------------------------------------------
    // Initialize ORB object.

//------------------------------------------------------------------------
    int    argc=0;       // Dummy variables to support following call.
    char** argv=0;
    CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);



//------------------------------------------------------------------------
    // Bind ORB object to name service object.
    // (Reference to Name service root context.)

//------------------------------------------------------------------------
    CORBA::Object_var obj = orb->resolve_initial_references("NameService");
    assert (!CORBA::is_nil(obj.in()));




//------------------------------------------------------------------------
    // Narrow this to the naming context (Narrowed reference to root
context.)

//------------------------------------------------------------------------
    CosNaming::NamingContext_var nc = CosNaming::NamingContext::_narrow(
obj.in());
    assert (!CORBA::is_nil(nc.in()));



//------------------------------------------------------------------------
    // The "name text" put forth by CORBA server in name service.
    // This same name ("DataServiceName1") is used by the CORBA server when
    // binding to the name server (CosNaming::Name).

//------------------------------------------------------------------------
    CosNaming::Name _corbaCosName;
    _corbaCosName.length(1);

    char str[100] = "DispatcherService";
    _corbaCosName[0].id=CORBA::string_dup((const char*)str);



//------------------------------------------------------------------------
    // Resolve "name text" identifier to an object reference.

//------------------------------------------------------------------------
    CORBA::Object_var obj1 = nc->resolve(_corbaCosName);
    assert(!CORBA::is_nil(obj1.in()));


    m_ObjCall = ProcessA ::_narrow(obj1.in());
    if (CORBA::is_nil(m_ObjCall.in()))
    {
       cerr << "IOR is not an SA object reference." << endl;
    }
  }

  catch(CORBA::COMM_FAILURE& ex) {
    cerr << "Caught system exception COMM_FAILURE -- unable to contact the "
         << "object." << endl;
    throw DS_ServerConnectionException();
    return;
  }
  catch(CORBA::SystemException& ) {
    cerr << "Caught a CORBA::SystemException." << endl;
    throw DS_SystemException();
    return;
  }
  catch(CORBA::Exception& ) {
    cerr << "Caught CORBA::Exception." << endl;
    throw DS_Exception();
    return;
  }
  catch(omniORB::fatalException& fe) {
    cerr << "Caught omniORB::fatalException:" << endl;
    cerr << "  file: " << fe.file() << endl;
    cerr << "  line: " << fe.line() << endl;
    cerr << "  mesg: " << fe.errmsg() << endl;
    throw DS_FatalException();
    return;
  }
  catch(...) {
    cerr << "Caught unknown exception." << endl;
    throw DS_Exception();
    return;
  }



Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20070221/ca0eb854/attachment.htm


More information about the omniORB-list mailing list