[omniORB] segmentation fault while trying to create an object
Enrico Sirola
sirolae@riskmap.net
17 Apr 2001 13:59:47 +0200
Hello,
I'm going to develop a sort of remote calculator exposing a CORBA
interface. The idl looks like:
module mymodule {
interface Calculator;
interface CalculatorDispatcher {
Calculator get();
};
interface Calculator {
void setA(...);
void setB(...);
<et cetera>
double calculateA ();
<et cetera>
double calculateXYZ ();
};
};
A calculator is a stateful object, and makes sense for one client
only, so i created this stateless factory object (CalculatorDispatcher)
which is accessible via the Naming Service and which creates a
calculator for a client requiring it. Prolly my implementation of this
interface is brain-damaged, here's what i did (with omniORBpy 1.3),
which makes omniORB segfault server-side while invoking
CalculatorDispatcher::get() :
the CalculatorDispatcher is created within a rootPOA's child with the
SINGLE_THREAD_MODEL policy and binds itself
to the Naming Service.
The dispatcher implementation is something like that:
--------------->server code for dispatcher<--------------
import PortableServer, CORBA
from Calculators import Calc_i
_objName="CalculatorDispatcher"
_objCtxt=["myctxt"]
class CalculatorDispatcher_i(mymodule__POA.CalculatorDispatcher):
def __init__(self, poa):
self.poa = poa
mgr = poa._get_the_POAManager()
mgr.activate()
def get(self):
opt_i = Calc_i()
self.poa.activate_object(opt_i)
return opt_i._this()
if __name__=='__main__':
import sys
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)
poa = orb.resolve_initial_references("RootPOA")
policies = [poa.create_thread_policy(
PortableServer.SINGLE_THREAD_MODEL)]
child = poa.create_POA("my_st_poa", None, policies)
odi = CalculatorDispatcher_i(poa)
child.activate_object(odi)
odo = odi._this()
# helpers for binding the object to the naming service
from NameServBind import ObjBind, CtxtBind
ctxt = CtxtBind(orb, _objCtxt)
ObjBind(ctxt, odo, _objName)
poaManager = child._get_the_POAManager()
poaManager.activate()
orb.run()
---------------->end of dispatcher code<--------------------
The Calculator objects, as you can see are created in the root POA
(which is passed in the CalculatorDispatcher_i constructor). The
Calc_i class does nothing exceptional, it's just a wrapper for an
extension c++ python module implementing the calculator.
What could the problem with my code be? Usually when there is some
kind of problem in the implementation of a servant the ORB catches
every python exception, but this segfault leaves me with no clue.
I hope my (maybe too long) post contains enough infos, if not let me
know it.
Thanks in advance for your advices,
Enrico
Enrico Sirola <enri@users.sourceforge.net>
gpg public key available from wwwkeys.pgp.net
Key fingerprint = B446 7332 ED55 BC68 5FE8 DE0F 98DF EC86 377F E07F