[omniORB] omniORBpy and apache/mod_python: ORB_init gets stuck

Juri Pakaste juri@iki.fi
24 May 2000 04:46:36 +0300


I'm trying to access a CORBA server from a Python script which is
being executed by mod_python. I'm running with mod_python 2.0, apache
1.3.12 and a version of omniORB 3.0 and omniORBpy which I checked out
from CVS just a hour or so ago.

Things work nicely when working from the command line; however, when
my script is being executed by mod_python, it gets stuck on the first
line that tries to access the ORB:

orb = CORBA.ORB_init([], CORBA.ORB_ID)

I'm passing it an empty list instead of sys.argv because it seems I
don't get a sys.argv with mod_python; the empty list doesn't seem to
bother omniORB. It looks like ORB_init never returns, or at least not
in any reasonable time. I can close the connection to the web server,
but the Apache process is apparently still stuck trying to access the
ORB.

If I run apachectl stop, the process doesn't go away. However, this is
printed to Apache's error log:

omniORB: Assertion failed -- mutex destroyed whilst held.
 This is a bug in omniORB. Please submit a report (with stack
 trace if possible) to <omniorb@uk.research.att.com>.

I'm pretty much completely unfamiliar with mod_python, so I don't know
what kind of weird things it does, but obviously something in it
causes breakage. Below is the ultra-simple test script I used. The
"got orb" line never gets printed to the log. It works just fine if I
comment out the from mod_python import apache line and run it as a
normal CGI.

Any help very much appreciated.



from mod_python import apache
import sys
from omniORB import CORBA
from Squeak import Stream
import CosNaming

server = None

def getServer():
    global server
    if server == None:
        sw = sys.stderr.write
        sw("in getServer, server was None, trying to get orb\n")
        orb = CORBA.ORB_init([], CORBA.ORB_ID)
        sw("got orb: " + str(orb) + "\n")
        ns = orb.resolve_initial_references("NameService")
        context = CosNaming.NameComponent("squeak", "")
        objectname = CosNaming.NameComponent("server", "Object")
        server = ns.resolve([context, objectname])
    return server

def handler(req):
    sys.stderr.write("foo\n")
    srv = getServer()
    req.send_http_header()
    req.write("Hello World!\n")
    req.write(str(srv))
    return apache.OK

if __name__ == '__main__':
    print "Content-type: text/plain\n"
    print getServer()

-- 
[ Juri Pakaste / juri@iki.fi / <URL:http://www.iki.fi/juri/> ]