[omniORB] -ORBclientTimeOutPeriod Bug When The Server Uses A Location Forward Request?

Wilson Jimmy - jiwils Jimmy.Wilson@acxiom.com
Wed, 15 May 2002 10:07:27 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C1FC22.3A00E7B0
Content-Type: text/plain; charset="iso-8859-1"

I forgot to attach the modified examples.

Jimmy
-- 
James "Jimmy" Wilson
Software Developer, Acxiom Corporation

-----Original Message-----
From: Wilson Jimmy - jiwils 
Sent: Wednesday, May 15, 2002 10:04 AM
To: omniORB Mailing List (E-mail)
Subject: RE: [omniORB] -ORBclientTimeOutPeriod Bug When The Server Uses
A Location Forward Request?


I modified the POA servant locator examples to test this functionality.  It
appears that when speaking omniORB to omniORB the timeout stuff works just
fine, regardless of whether or not a location forward request is made.  This
probably means this is an Orbix thing.  I've attached the modified examples
for the mailing list archives.

I did notice something interesting, and I wondered if someone could comment.
It appears that omniORB attempts to retry the function invocation when it
times out.  With the omniORB server, I see the servant locator preinvoke
method being called twice (for just one request).  With the Orbix server, I
see an IIOP disconnect/reconnect message.  Am I interpreting what I am
seeing correctly?  Is so, could the whole connection by thread issue be
coming into play in this scenario when using Orbix?  Would turning on
omniORB's trace level tell me anything regarding this?

Any comments would be helpful.

Jimmy
-- 
James "Jimmy" Wilson
Software Developer, Acxiom Corporation

-----Original Message-----
From: Wilson Jimmy - jiwils [mailto:Jimmy.Wilson@acxiom.com]
Sent: Tuesday, May 14, 2002 1:38 PM
To: omniORB Mailing List (E-mail)
Subject: [omniORB] -ORBclientTimeOutPeriod Bug When The Server Uses A
Location Forwa rd Request?


I've written a sample client to an Orbix 3.0.1 service.  It works fine when
the server behaves normally.

I added some code to the client that sets the client time out period, but it
does not appear to work with Orbix.  This same setting seems to work with
ORBs.  I do not think that this is an Orbix problem per se because Orbix
uses location forward requests, and they (I think) may be the source of the
problem.

The attached client works fine when the server is set to behave
appropriately.  When the Orbix server is set to sleep for 25 seconds or so
in the middle of an invocation, the client never times out.

Does anyone know if this is a problem or not?  I can (and will probably)
write an omniORB server that uses location forward requests to see if I can
replicate this behavior, but I don't have one currently.  I was hoping that
someone had already run into this problem (or at least knew it existed)
before I take the time to try and prove it.

Any thoughts?

Jimmy
-- 
James "Jimmy" Wilson
Software Developer, Acxiom Corporation

 <<ErrorService.py>>



*********************************************************************

The information contained in this communication is
confidential, is intended only for the use of the recipient
named above, and may be legally privileged.
If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, 
distribution, or copying of this communication is strictly
prohibited.
If you have received this communication in error,
please re-send this communication to the sender and
delete the original message or any copy of it from your
computer system. Thank You.


------_=_NextPart_000_01C1FC22.3A00E7B0
Content-Type: application/octet-stream;
	name="echo_clt.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="echo_clt.py"

#!/usr/bin/env python=0A=
=0A=
import string=0A=
import sys=0A=
=0A=
# Import the CORBA module=0A=
from omniORB import CORBA=0A=
=0A=
# Import the stubs for the global module=0A=
import _GlobalIDL=0A=
=0A=
# Initialise the ORB=0A=
orb =3D CORBA.ORB_init(['', '-ORBclientCallTimeOutPeriod', '5'], =
CORBA.ORB_ID)=0A=
=0A=
# Get the IOR of an Echo object from the command line (without=0A=
# checking that the arguments are sensible!)=0A=
file =3D open('ior.txt', 'r')=0A=
ior =3D string.strip(file.read())=0A=
file.close()=0A=
=0A=
# Convert the IOR to an object reference=0A=
obj =3D orb.string_to_object(ior)=0A=
=0A=
# Narrow reference to an Echo object=0A=
eo  =3D obj._narrow(_GlobalIDL.Echo)=0A=
=0A=
if eo is None:=0A=
    print "Object reference is not an Echo"=0A=
    sys.exit(1)=0A=
=0A=
# Invoke the echoString operation=0A=
message =3D "Hello from Python"=0A=
result  =3D eo.echoString(message)=0A=
=0A=
print "I said '%s'. The object said '%s'." % (message,result)=0A=

------_=_NextPart_000_01C1FC22.3A00E7B0
Content-Type: application/octet-stream;
	name="servantlocator.py"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="servantlocator.py"

#!/usr/bin/env python=0A=
=0A=
# Example of using a ServantLocator.=0A=
#=0A=
=0A=
# This program behaves just like the echo server, except that the=0A=
# servant object is activated and deactivated again on each request =
to=0A=
# the object.=0A=
#=0A=
# If you run with a -l command line argument, the program will make =
a=0A=
# number of local calls to the object, showing that the activator =
runs=0A=
# in the local, as well as the remote, case.=0A=
=0A=
import sys, time=0A=
from omniORB import CORBA, PortableServer, PortableServer__POA=0A=
=0A=
import _GlobalIDL, _GlobalIDL__POA=0A=
=0A=
class Echo_i (_GlobalIDL__POA.Echo):=0A=
    def __init__(self):=0A=
        print "Echo_i created."=0A=
=0A=
    def __del__(self):=0A=
        print "Echo_i deleted."=0A=
=0A=
    def echoString(self, mesg):=0A=
        print "echoString() called with message:", mesg=0A=
        time.sleep(25)=0A=
        return mesg=0A=
=0A=
class ServantLocator_i (PortableServer__POA.ServantLocator):=0A=
    def preinvoke(self, oid, poa, operation):=0A=
        print "preinvoke(): oid:", oid, "poa:", poa._get_the_name()=0A=
        ei =3D Echo_i()=0A=
        return (ei, "Hmm, cookies")=0A=
=0A=
    def postinvoke(self, oid, poa, operation, cookie, serv):=0A=
        print "postinvoke(): oid:", oid, "poa:", poa._get_the_name(), =
\=0A=
              "cookie: `" + cookie + "'"=0A=
=0A=
# Initialise the ORB and activate the root POA.=0A=
orb =3D CORBA.ORB_init(sys.argv, CORBA.ORB_ID)=0A=
poa =3D orb.resolve_initial_references("RootPOA")=0A=
poaManager =3D poa._get_the_POAManager()=0A=
poaManager.activate()=0A=
=0A=
# Create a child POA with the right policies for a ServantLocator=0A=
ps =3D [poa.create_id_assignment_policy(PortableServer.USER_ID),=0A=
      =
poa.create_servant_retention_policy(PortableServer.NON_RETAIN),=0A=
      =
poa.create_request_processing_policy(PortableServer.USE_SERVANT_MANAGER)=
]=0A=
=0A=
child =3D poa.create_POA("MyPOA", poaManager, ps)=0A=
=0A=
# Create the ServantLocator and set it as the child's ServantManager=0A=
sli =3D ServantLocator_i()=0A=
slo =3D sli._this()=0A=
child.set_servant_manager(slo)=0A=
=0A=
# Create an object reference with no servant=0A=
eo =3D child.create_reference_with_id("MyEcho", =
CORBA.id(_GlobalIDL.Echo))=0A=
print orb.object_to_string(eo)=0A=
file =3D open('ior.txt', 'w')=0A=
file.write(orb.object_to_string(eo))=0A=
file.close()=0A=
=0A=
# Run, or do some local calls...=0A=
if not (len(sys.argv) > 1 and sys.argv[1] =3D=3D "-l"):=0A=
    orb.run()=0A=
=0A=
time.sleep(1)=0A=
=0A=
print "Calling..."=0A=
=0A=
# On each of these calls, the servant is created just before the=0A=
# invocation, and deleted again just afterwards=0A=
=0A=
print eo.echoString("Hello from same address space")=0A=
time.sleep(1)=0A=
=0A=
print eo.echoString("Hello again")=0A=
time.sleep(1)=0A=
=0A=
print eo.echoString("Hello again again")=0A=
time.sleep(1)=0A=
=0A=
print "Destroying POA..."=0A=
child.destroy(1, 1)=0A=
print "Destroyed"=0A=

------_=_NextPart_000_01C1FC22.3A00E7B0
Content-Type: application/octet-stream;
	name="frservantlocator.py"
Content-Disposition: attachment;
	filename="frservantlocator.py"

#!/usr/bin/env python

# Example of using a ServantLocator.
#

# This program behaves just like the echo server, except that the
# servant object is activated and deactivated again on each request to
# the object.
#
# If you run with a -l command line argument, the program will make a
# number of local calls to the object, showing that the activator runs
# in the local, as well as the remote, case.

import sys, time, string
from omniORB import CORBA, PortableServer, PortableServer__POA

import _GlobalIDL, _GlobalIDL__POA

class Echo_i (_GlobalIDL__POA.Echo):
    def __init__(self):
        print "Echo_i created."

    def __del__(self):
        print "Echo_i deleted."

    def echoString(self, mesg):
        print "echoString() called with message:", mesg
        return mesg

class ServantLocator_i (PortableServer__POA.ServantLocator):
    reference = None

    def __init__(self):
        file = open('ior.txt', 'r')
        ior = string.strip(file.read())
        orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
        self.reference = orb.string_to_object(ior)
        
    def preinvoke(self, oid, poa, operation):
        print "preinvoke(): oid:", oid, "poa:", poa._get_the_name()
        raise PortableServer.ForwardRequest(self.reference)
        ei = Echo_i()
        return (ei, "Hmm, cookies")

    def postinvoke(self, oid, poa, operation, cookie, serv):
        print "postinvoke(): oid:", oid, "poa:", poa._get_the_name(), \
              "cookie: `" + cookie + "'"

# Initialise the ORB and activate the root POA.
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
poaManager = poa._get_the_POAManager()
poaManager.activate()

# Create a child POA with the right policies for a ServantLocator
ps = [poa.create_id_assignment_policy(PortableServer.USER_ID),
      poa.create_servant_retention_policy(PortableServer.NON_RETAIN),
      poa.create_request_processing_policy(PortableServer.USE_SERVANT_MANAGER)]

child = poa.create_POA("MyPOA", poaManager, ps)

# Create the ServantLocator and set it as the child's ServantManager
sli = ServantLocator_i()
slo = sli._this()
child.set_servant_manager(slo)

# Create an object reference with no servant
eo = child.create_reference_with_id("MyEcho", CORBA.id(_GlobalIDL.Echo))
print orb.object_to_string(eo)

# Run, or do some local calls...
if not (len(sys.argv) > 1 and sys.argv[1] == "-l"):
    orb.run()

time.sleep(1)

print "Calling..."

# On each of these calls, the servant is created just before the
# invocation, and deleted again just afterwards

print eo.echoString("Hello from same address space")
time.sleep(1)

print eo.echoString("Hello again")
time.sleep(1)

print eo.echoString("Hello again again")
time.sleep(1)

print "Destroying POA..."
child.destroy(1, 1)
print "Destroyed"

------_=_NextPart_000_01C1FC22.3A00E7B0--