Hallo Thomas, all!
just playing around with pyext to make a simple remote procedure call I have the following problem: (python script is attached)
when I try to call the method "trigger" from an other program, PD always is crashing with the following backtrace:
----------8<---------- Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1345365072 (LWP 7095)] 0xb6d34602 in pyext::pyext_outlet () from /usr/lib/pd/extra/py.pd_linux (gdb) bt #0 0xb6d34602 in pyext::pyext_outlet () from /usr/lib/pd/extra/py.pd_linux #1 0xb6c57308 in PyCFunction_Call () from /usr/lib/libpython2.3.so.1.0 #2 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #3 0xb6c8dd4c in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #4 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #5 0xb6c44845 in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #6 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #7 0xb6c8f422 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #8 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #9 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #10 0xb6c90b1f in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #11 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #12 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #13 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #14 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #15 0xb6c44845 in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #16 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #17 0xb6c314c3 in PyMethod_New () from /usr/lib/libpython2.3.so.1.0 #18 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #19 0xb6c8b11d in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.3.so.1.0 #20 0xb6c33c0a in PyInstance_New () from /usr/lib/libpython2.3.so.1.0 #21 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 ---Type <return> to continue, or q <return> to quit--- #22 0xb6c8dd4c in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #23 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #24 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #25 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #26 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #27 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #28 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #29 0xb6c44845 in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #30 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #31 0xb6c314c3 in PyMethod_New () from /usr/lib/libpython2.3.so.1.0 #32 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #33 0xb6c8b11d in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.3.so.1.0 #34 0xb6cbdf71 in PyGC_Collect () from /usr/lib/libpython2.3.so.1.0 #35 0xb7f9fccd in start_thread () from /lib/tls/libpthread.so.0 #36 0xb7f33b0e in clone () from /lib/tls/libc.so.6 (gdb) -------------8<------------
I gues I am using something in a wrong way, but if I don't try to send the number to the outlet (line 31 in xmlrpc_server.py) there is no crash (e.g. a simple print in python works fine ...)
Thanks for any hint, LG Georg
Hi Georg, thanks for the report, but that's a really complex thing which needs some in-deep analysis Unfortunately debugging that means that i'll have to build debug versions of the modules used, and that's a bit out of scope at the moment. I'll see what i can do....
all the best, Thomas
Georg Holzmann schrieb:
Hallo Thomas, all!
just playing around with pyext to make a simple remote procedure call I have the following problem: (python script is attached)
when I try to call the method "trigger" from an other program, PD always is crashing with the following backtrace:
----------8<---------- Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1345365072 (LWP 7095)] 0xb6d34602 in pyext::pyext_outlet () from /usr/lib/pd/extra/py.pd_linux (gdb) bt #0 0xb6d34602 in pyext::pyext_outlet () from /usr/lib/pd/extra/py.pd_linux #1 0xb6c57308 in PyCFunction_Call () from /usr/lib/libpython2.3.so.1.0 #2 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #3 0xb6c8dd4c in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #4 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #5 0xb6c44845 in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #6 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #7 0xb6c8f422 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #8 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #9 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #10 0xb6c90b1f in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #11 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #12 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #13 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #14 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #15 0xb6c44845 in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #16 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #17 0xb6c314c3 in PyMethod_New () from /usr/lib/libpython2.3.so.1.0 #18 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #19 0xb6c8b11d in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.3.so.1.0 #20 0xb6c33c0a in PyInstance_New () from /usr/lib/libpython2.3.so.1.0 #21 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 ---Type <return> to continue, or q <return> to quit--- #22 0xb6c8dd4c in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #23 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #24 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #25 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #26 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #27 0xb6c90da5 in _PyEval_SliceIndex () from /usr/lib/libpython2.3.so.1.0 #28 0xb6c91a4a in PyEval_EvalCodeEx () from /usr/lib/libpython2.3.so.1.0 #29 0xb6c44845 in PyFunction_SetClosure () from /usr/lib/libpython2.3.so.1.0 #30 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #31 0xb6c314c3 in PyMethod_New () from /usr/lib/libpython2.3.so.1.0 #32 0xb6c29f2a in PyObject_Call () from /usr/lib/libpython2.3.so.1.0 #33 0xb6c8b11d in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.3.so.1.0 #34 0xb6cbdf71 in PyGC_Collect () from /usr/lib/libpython2.3.so.1.0 #35 0xb7f9fccd in start_thread () from /lib/tls/libpthread.so.0 #36 0xb7f33b0e in clone () from /lib/tls/libc.so.6 (gdb) -------------8<------------
I gues I am using something in a wrong way, but if I don't try to send the number to the outlet (line 31 in xmlrpc_server.py) there is no crash (e.g. a simple print in python works fine ...)
Thanks for any hint, LG Georg
# ================================================ # py script for pure data # """scripts to get messages from a xmlrpc server""" # # (c) 2005, Georg Holzmann, grh@mur.at # ================================================
# ================================================ # imports import pyext, SimpleXMLRPCServer, threading from SimpleXMLRPCServer import SimpleXMLRPCServer
# ================================================ # PDxmlrpc class class PDxmlrpc(pyext._class): """ xmlrpc server """
# define in, outlets _inlets=1 _outlets=1
# start server def start_server_1(self, port): s = AsyncServer(port) s.start()
# trigger a specific number and # put it out to pd def trigger(self, number): self._outlet(1,number)
# ====================================================================== # xmlrpc server class AsyncServer(threading.Thread): """Starts the xmlrpc-server asynchron""" def __init__(self, port): threading.Thread.__init__(self) self.port = port def run(self): self.server = SimpleXMLRPCServer(("localhost", self.port)) self.server.register_instance(PDxmlrpc()) print "xmlrpc server serving on port ", self.port self.server.serve_forever()
# EOF # ======================================================================
PD-dev mailing list PD-dev@iem.at http://lists.puredata.info/listinfo/pd-dev
Hi Georg, seems i incidentally stumbled across the bug...
when I try to call the method "trigger" from an other program, PD always is crashing with the following backtrace:
I gues I am using something in a wrong way, but if I don't try to send the number to the outlet (line 31 in xmlrpc_server.py) there is no crash (e.g. a simple print in python works fine ...)
# ================================================ # PDxmlrpc class class PDxmlrpc(pyext._class): """ xmlrpc server """
# define in, outlets _inlets=1 _outlets=1
# start server def start_server_1(self, port): s = AsyncServer(port) s.start()
# trigger a specific number and # put it out to pd def trigger(self, number): self._outlet(1,number)
# ====================================================================== # xmlrpc server class AsyncServer(threading.Thread): """Starts the xmlrpc-server asynchron""" def __init__(self, port): threading.Thread.__init__(self) self.port = port def run(self): self.server = SimpleXMLRPCServer(("localhost", self.port)) self.server.register_instance(PDxmlrpc())
the problem is that in the last line you are creating a new instance of the PDxmlrpc class, although you want to output data over the one you created with the pyext object (which represents a PD external). You'd rather have to store and use a reference to your existing object, like in the following. (also xmlrpc wants to have non-None return values from the methods) The basic problem with that is that you create a circular reference which e.g. inhibits reloading of modules with pyext etc. This might not be a problem for you though, letting the server run forever.
# ================================================ # py script for pure data # """scripts to get messages from a xmlrpc server""" # # (c) 2005, Georg Holzmann, grh@mur.at # ================================================
# ================================================ # imports import pyext, SimpleXMLRPCServer, threading from SimpleXMLRPCServer import SimpleXMLRPCServer # ================================================ # PDxmlrpc class class PDxmlrpc(pyext._class): """ xmlrpc server """ # define in, outlets _inlets=1 _outlets=1 # start server def start_server_1(self, port): s = AsyncServer(port,self) s.start() # trigger a specific number and # put it out to pd def trigger(self, number): self._outlet(1,number) return True
# ====================================================================== # xmlrpc server class AsyncServer(threading.Thread): """Starts the xmlrpc-server asynchron""" def __init__(self, port,inst): threading.Thread.__init__(self) self.port = port self.inst = inst def run(self): self.server = SimpleXMLRPCServer(("localhost", self.port)) self.server.register_instance(self.inst) print "xmlrpc server serving on port ", self.port self.server.serve_forever()
# EOF # ======================================================================
Hallo Thomas!
wow - many, many, ... thanks ;) - now it is working ...
the problem is that in the last line you are creating a new instance of the PDxmlrpc class, although you want to output data over the one you created with the pyext object (which represents a PD external). You'd rather have to store and use a reference to your existing object, like in the following.
okay - I understand ... thanks
LG Georg