[omniORB] omniORBpy: destroy() call hangs after a fork

Forest Zachman fzachman at codeit.com
Mon May 9 16:08:15 BST 2005


Hi there,

I'm having some trouble using omniORB in python with code that forks.  
I'm sure it's some problem with the forked process getting a copy of the 
parents memory, but I'm not really sure what's going on here.  Here's an 
example (based on the echo example):

#!/usr/bin/python2.3
from omniORB import CORBA, PortableServer
import sys
import Example, Example__POA
from os import fork

BASE_ENDPOINT = 7777

class Echo_i (Example__POA.Echo):
    def echoString(self, mesg):
        print "echoString() called with message:", mesg
        return mesg

args = sys.argv[:]
args.append("-ORBInitRef")
args.append("NameService=corbaname::1.2 at localhost:49000")
args.append("-ORBacceptBiDirectionalGIOP")
args.append("1")
args.append("-ORBserverTransportRule")
args.append("* unix,tcp,bidir")
args.append("-ORBendPoint")
args.append('giop:tcp::%s' % BASE_ENDPOINT)
       
orb = CORBA.ORB_init(args, CORBA.ORB_ID)

pid = fork()
if pid == 0: 
    # We're a child..we need our own copy of the orb
    orb.destroy()
    args.append("-ORBInitRef")
    args.append("NameService=corbaname::1.2 at localhost:49000")
    args.append("-ORBacceptBiDirectionalGIOP")
    args.append("1")
    args.append("-ORBserverTransportRule")
    args.append("* unix,tcp,bidir")
    args.append("-ORBendPoint")
    args.append('giop:tcp::%s' % (BASE_ENDPOINT +1))
    orb = CORBA.ORB_init(args, CORBA.ORB_ID)

poa = orb.resolve_initial_references("RootPOA")

ei = Echo_i()
eo = ei._this()

if pid == 0:
    print "Child: %s" % orb.object_to_string(eo)
else:
    print "Parent: %s" % orb.object_to_string(eo)


poaManager = poa._get_the_POAManager()
poaManager.activate()

orb.run()



If I run this, the child process hangs on the orb.destroy() command.  If 
I don't call destroy(), then I get the following message:

omniORB: Error: Unable to create an endpoint of this description: 
giop:tcp::7777

And this exception:
Traceback (most recent call last):
  File "./CorbaServer.py", line 52, in ?
    poa = orb.resolve_initial_references("RootPOA")
  File "/usr/lib/python2.3/site-packages/CORBA.py", line 483, in 
resolve_initial_references
    
omniORB.CORBA.INITIALIZE: Minor: INITIALIZE_TransportError, COMPLETED_NO.


I'm confused, as I've passed new arguments to CORBA.ORB_init().  But I'm 
guessing that the module keeps a reference to the original arguments 
passed it and the new ones aren't overriding it?

Any help would be greatly appreciated.  I'm at a dead end with my own 
limited knowledge.

Thanks,
Forest



More information about the omniORB-list mailing list