[omniORB] Synchronization between omniNames service & Services
Philip Tait
philip at subaru.naoj.org
Tue Aug 5 12:15:15 BST 2008
I had the same issue. Here's my updated version of
'examples/echo/example_echo_nsclt.py' that tolerates stop and restart of
'examples/echo/example_echo_srv.py'
Comments and suggestions for improvement are welcome.
Philip J. Tait
http://subarutelescope.org
------------------------------------------------------
#!/usr/bin/env python
import sys
# Import the CORBA module
from omniORB import CORBA
# Import the stubs for the CosNaming and Example modules
import CosNaming, Example
def bindContext(name):
try:
obj = rootContext.resolve(name)
except CosNaming.NamingContext.NotFound, ex:
print "Name not found"
sys.exit(1)
# Narrow the object to an Example::Echo
eo = obj._narrow(Example.Echo)
if eo is None:
print "Object reference is not an Example::Echo"
sys.exit(1)
return eo
# Initialise the ORB
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
# Obtain a reference to the root naming context
obj = orb.resolve_initial_references("NameService")
rootContext = obj._narrow(CosNaming.NamingContext)
if rootContext is None:
print "Failed to narrow the root naming context"
sys.exit(1)
# Resolve the name "test.my_context/ExampleEcho.Object"
name = [CosNaming.NameComponent("test", "my_context"),
CosNaming.NameComponent("ExampleEcho", "Object")]
eo = bindContext(name)
import time
import traceback
# Invoke the echoString operation
message = "Hello from Python"
while True:
while True:
try:
result = eo.echoString(message)
break
except (CORBA.COMM_FAILURE, CORBA.TRANSIENT):
traceback.print_exc()
eo = bindContext(name)
time.sleep(1)
print "I said '%s'. The object said '%s'." % (message,result)
time.sleep(10)
--------------------------------------------------------------------------
On Tue, 2008-08-05 at 15:12 +0100, Nigel Rantor wrote:
> sorry, meant to reply to list, not just to OP
>
> R. P. Janaka wrote:
> > The second one is the scenario..
> >
> > As you think I am also guess, the problem is trying to contact the
> > original object reference that was registered with the Nameservice
> > rather than the new one.
>
> Yes. That does look to be your problem.
>
> To make this work you will have to make the client smart enough to
> look-up the object reference again if it finds that it fails like this.
>
> n
>
> >
> > On Tue, Aug 5, 2008 at 3:09 PM, Nigel Rantor <wiggly at wiggly.org
> > <mailto:wiggly at wiggly.org>> wrote:
> >
> > R. P. Janaka wrote:
> >
> > No.. still did not get a solution.
> >
> > As I found with new experiments, this problem is not a specific
> > for this Master/Slave case. If we just consider only about the
> > Master, Problem still remains. I found these result with debugging.
> >
> > I just repeat the same procedure with only a single server.
> >
> > * Start the server and get registered with the name service
> > * Manually kill the server
> > * Start the server and get registered with the name service
> > *again *.
> >
> >
> > Then the registration also get success. But when the client try
> > to call server's functions, it gives this exception.
> >
> > the exception is *"SystemException: TRANSIENT_ConnectFailed"*
> >
> > The reason for this problem may be the sudden break down of the
> > server with out informing it to the name service.
> >
> > Do we have any solution for this....?
> >
> >
> > You're going to have to be more explicit about this.
> >
> > Which of the following is the order things are happening in?
> >
> > A
> > --------------------------------------------------------------
> > - Start server
> > - Server registers with Nameservice as "server"
> > - Kill server
> > - Start server again
> > - Server registers with Nameservice as "server"
> > - Start client
> > - Client looks up "server" with Nameservice
> > - Client invokes an operation on the reference from the Nameservice
> > - Client gets "SystemException: TRANSIENT_ConnectFailed"
> > --------------------------------------------------------------
> >
> > B
> > --------------------------------------------------------------
> > - Start server
> > - Server registers with Nameservice as "server"
> > - Client looks up "server" with Nameservice
> > - Kill server
> > - Start server again
> > - Server registers with Nameservice as "server"
> > - Start client
> > - Client invokes an operation on the reference from the Nameservice
> > - Client gets "SystemException: TRANSIENT_ConnectFailed"
> > --------------------------------------------------------------
> >
> > My question is, has the client got the most recently bound name from
> > the nameservice or not?
> >
> > It appears from you description that it is trying to contact the
> > original object reference that was registered with the Nameservice
> > rather than the new one.
> >
> > n
> >
> >
> >
> >
> > --
> > Regards,
> > R. P. Janaka
>
>
>
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
More information about the omniORB-list
mailing list