[omniORB] omniORBpy: segfault/bus errors using Any?

Mark Borges mdb@jimi.nwest.mccaw.com
14 Dec 1999 22:08:24 -0800


I'm not sure if this is an obscure compiler/optimization bug, a
misunderstanding of the Python mapping for Any on my part, or
something else entirely different.

Running the following snippet of code (which is boiled down from a
larger application and basically nonsensical as-is) I consistently get
a segmentation fault:

-----------------------------------------------------------------------
$ ./srv.py &
IOR:000000000000001049444c3a592f5265706c793a312e300000000001000000000000002c000100000000000f3134312e3230342e3137382e3638000299e100000000000c38572cf3a7abb22b00000002

$ ./clt.py
xx= PENDING
typecode= <omniORB.CORBA.TypeCode instance at 12bea8>
<method Any.typecode of Any instance at 12bec0>
{'dueDate': '01/01/2000', 'woState': PENDING, 'woId': '12345'}
zsh: 16940 segmentation fault (core dumped)  ./clt.py
-----------------------------------------------------------------------

Can anyone verify if this is reproducible elsewhere, or if I should
focus more on the local installation of omniORBpy and the specific
build I'm using on this OS:

  $ gcc -dumpversion -dumpmachine
  2.95.2
  $ gcc -dumpmachine 
  sparc-sun-solaris2.6
  $ uname -a
  SunOS jimi 5.6 Generic_105181-14 sun4u sparc SUNW,Ultra-5_10

Or if I've done something boneheaded in the appended code?

-----------------------------------------------------------------------
$ cat Y.idl
module Y {

  enum jobState {
    PENDING,
    COMPLETED
  };

  struct Foo {
    string woId;
    jobState woState;
    string dueDate;
  };

  interface Reply {
    oneway void result (in unsigned long id,
                        in boolean success,
                        in any data);
  }; //end of interface
}; // end of module

-----------------------------------------------------------------------
$ cat srv.py 
#!/usr/bin/env python
import sys
from omniORB import CORBA, PortableServer

# Import the skeletons
import POA_Y

# Initialise the ORB
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)

# Find the POA
poa = orb.resolve_initial_references("RootPOA")

# Activate the POA
poaManager = poa._get_the_POAManager()
poaManager.activate()

class PushMe_i (POA_Y.Reply):
    def result(self, id,ok,data):
        print "result() called"
        print "id=",id
        print "ok code=",ok
        print data.typecode()
        print data.value().woId
        print data.value().woState

# Create an instance of it
ei = PushMe_i()

# Create an object reference, and implicitly activate the object
eo = ei._this()

# Print out the IOR
ior = orb.object_to_string(eo)
print ior
# Stash it in a file
open('srv.ior', 'w').write(ior)

# Everything is running now, but if this thread drops out of the end
# of the file, the process will exit. orb.run() just blocks for ever
orb.run()

-----------------------------------------------------------------------
$ cat clt.py
#!/usr/bin/env python
import sys

# Import the CORBA module
from omniORB import CORBA

# Import the stubs
import Y

# Initialise the ORB
orb = CORBA.ORB_init(sys.argv, CORBA.ORB_ID)

# Read the server's stringified IOR from a file.
my_ior = open('srv.ior', 'r').read()
# Convert the IOR to an object reference
object = orb.string_to_object(my_ior)

xx=Y.PENDING
print 'xx=',xx
c = Y.Foo('12345',Y.PENDING,'01/01/2000')
# Now create the "Any".
tc = CORBA.TypeCode('IDL:Y/Foo:1.0')
print "typecode=",tc
# -----------------------------------------------------------------------
aa = CORBA.Any(tc, c)
print aa.typecode
print aa.value().__dict__

id = 3
success = 1
object.result(id,success,aa)
print "oneway push done"