Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Need Help : random segfault in pyside 1.2.4 due to PySide::DynamicQMetaObject::update() :(



  • Hi,
    I am coding a Pyside app and I am pulling my hair over something, I think is beyond me.
    I am on linux (ubuntu 16.04) and using Pyside 1.2.4 with Python 2.7, in a virtualenv.

    I got random crashes in unrelated parts of the code but when using gdb, the last line of the trace is always PySide::DynamicQMetaObject::update().
    Looking on the net, I found only this old example of a somewhat similar situation : http://lists.qt-project.org/pipermail/pyside/2013-April/001341.html
    ( the trace is very similar to mine)

    The cause of the crashes, while indirect, is always the same though : some creation and deletion of layout and widgets. It happends after a while, and the python code crashes in different places, that are all QObject creation (widgets, layouts or timers).

    I don't know what to do. I really need help, there, the app is finished except for this nasty einsenbug.

    Here the python stack trace :

      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 273, in createTerminalWidgetProxy
        name_layout = QHBoxLayout(w)
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 358, in addTerminalWidget
        terminal = createTerminalWidgetProxy(self.value_layout, self.visitor)
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 240, in visit_node
        widget = parent.addTerminalWidget()
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 233, in visit
        self.visit_node( name, stream, parent)
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 260, in visit_node
        self.visit(sub_streams, widget)
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 233, in visit
        self.visit_node( name, stream, parent)
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 144, in add_to
        self.visitor.visit(sub_streams, widget)
      File "/home/lionel/code/parametric/reactive2/rectitude/ui/property/base.py", line 136, in on_node_selection
    

    and the gdb stack trace :

    #0  0x00007ffff5cb4e44 in PySide::DynamicQMetaObject::update() const () from /home/lionel/Envs/rectitude/local/lib/python2.7/site-packages/PySide/libpyside-python2.7.so.1.2
    #1  0x00007ffff5cb9466 in PySide::SignalManager::retriveMetaObject(_object*) () from /home/lionel/Envs/rectitude/local/lib/python2.7/site-packages/PySide/libpyside-python2.7.so.1.2
    #2  0x00007ffff370f0ab in Sbk_QHBoxLayout_Init () from /home/lionel/Envs/rectitude/local/lib/python2.7/site-packages/PySide/QtGui.so
    #3  0x00000000004b670c in type_call.lto_priv () at ../Objects/typeobject.c:765
    #4  0x00000000004b0cb3 in PyObject_Call () at ../Objects/abstract.c:2546
    #5  0x00000000004c9faf in do_call (nk=<optimized out>, na=1, pp_stack=0x7fffffff8ca0, func=<Shiboken.ObjectType at remote 0x7ffff40522c0>) at ../Python/ceval.c:4567
    #6  call_function (oparg=<optimized out>, pp_stack=0x7fffffff8ca0) at ../Python/ceval.c:4372
    #7  PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #8  0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff8df0, func=<function at remote 0x7fffeecf6b90>) at ../Python/ceval.c:4435
    #9  call_function (oparg=<optimized out>, pp_stack=0x7fffffff8df0) at ../Python/ceval.c:4370
    #10 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #11 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff8f40, func=<function at remote 0x7fffeecf8c80>) at ../Python/ceval.c:4435
    #12 call_function (oparg=<optimized out>, pp_stack=0x7fffffff8f40) at ../Python/ceval.c:4370
    #13 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #14 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9090, func=<function at remote 0x7fffeecf85f0>) at ../Python/ceval.c:4435
    #15 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9090) at ../Python/ceval.c:4370
    #16 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #17 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff91e0, func=<function at remote 0x7fffeecf8578>) at ../Python/ceval.c:4435
    #18 call_function (oparg=<optimized out>, pp_stack=0x7fffffff91e0) at ../Python/ceval.c:4370
    #19 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #20 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9330, func=<function at remote 0x7fffeecf85f0>) at ../Python/ceval.c:4435
    #21 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9330) at ../Python/ceval.c:4370
    #22 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #23 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9480, func=<function at remote 0x7fffeecf8578>) at ../Python/ceval.c:4435
    #24 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9480) at ../Python/ceval.c:4370
    #25 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #26 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff95d0, func=<function at remote 0x7fffeecf81b8>) at ../Python/ceval.c:4435
    #27 call_function (oparg=<optimized out>, pp_stack=0x7fffffff95d0) at ../Python/ceval.c:4370
    #28 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #29 0x00000000004c2765 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
    #30 0x00000000004de8b8 in function_call.lto_priv () at ../Objects/funcobject.c:523
    #31 0x00000000004b0cb3 in PyObject_Call () at ../Objects/abstract.c:2546
    #32 0x00000000004c6ad1 in ext_do_call (nk=<optimized out>, na=<optimized out>, flags=<optimized out>, pp_stack=0x7fffffff9888, func=<function at remote 0x7fffeecf80c8>) at ../Python/ceval.c:4664
    #33 PyEval_EvalFrameEx () at ../Python/ceval.c:3026
    #34 0x00000000004c2765 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
    #35 0x00000000004ca8d1 in fast_function (nk=0, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9a90, func=<function at remote 0x7fffeecf8140>) at ../Python/ceval.c:4445
    #36 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9a90) at ../Python/ceval.c:4370
    #37 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #38 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9be0, func=<function at remote 0x7fffefa7b230>) at ../Python/ceval.c:4435
    #39 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9be0) at ../Python/ceval.c:4370
    #40 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #41 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9d30, func=<function at remote 0x7fffefa752a8>) at ../Python/ceval.c:4435
    #42 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9d30) at ../Python/ceval.c:4370
    #43 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #44 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9e80, func=<function at remote 0x7fffefa750c8>) at ../Python/ceval.c:4435
    #45 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9e80) at ../Python/ceval.c:4370
    #46 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #47 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffff9fd0, func=<function at remote 0x7fffefa7b500>) at ../Python/ceval.c:4435
    #48 call_function (oparg=<optimized out>, pp_stack=0x7fffffff9fd0) at ../Python/ceval.c:4370
    #49 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #50 0x00000000004c9d8f in fast_function (nk=<optimized out>, na=<optimized out>, n=<optimized out>, pp_stack=0x7fffffffa120, func=<function at remote 0x7fffeef90c80>) at ../Python/ceval.c:4435
    #51 call_function (oparg=<optimized out>, pp_stack=0x7fffffffa120) at ../Python/ceval.c:4370
    #52 PyEval_EvalFrameEx () at ../Python/ceval.c:2987
    #53 0x00000000004c2765 in PyEval_EvalCodeEx () at ../Python/ceval.c:3582
    #54 0x00000000004c2509 in PyEval_EvalCode (co=<optimized out>, globals=<optimized out>, locals=<optimized out>) at ../Python/ceval.c:669
    #55 0x0000000000521186 in run_mod.lto_priv.1854 (arena=0x3b94460, flags=0x0, 
        locals={'self': <Node(real_node=<NodeInterface(node=<Operator(on_next=[<instancemethod at remote 0x7fffba67a730>, <instancemethod at remote 0x7fffba291f00>, <instancemethod at remote 0x7fffba291c80>], name=u'Split#9', _attr=<Struct(func=<AttributeProxy(attribute=<Attribute(type_val=<FuncT(val_func=<function at remote 0x7fffefabca28>, name='function', factory_func=None) at remote 0x7fffefae6350>, attr_name='func', streams={}) at remote 0x7fffefaae5d0>, on_error=[], on_end=[], obj=<...>, on_next=[]) at remote 0x7fffba69b550>, name=<AttributeProxy(attribute=<Attribute(type_val=<ClassType(cls=<type at remote 0x9056a0>) at remote 0x7fffefa98e90>, attr_name='name', streams={<Value(on_next=[<instancemethod at remote 0x7fffba67a960>, <instancemethod at remote 0x7fffba67a5a0>], name=u'bool#10', _attr=<Struct(name=<AttributeProxy(attribute=<...>, on_error=[], on_end=[], obj=<...>, on_next=[<function at remote 0x7fffba68e140>]) at remote 0x7fffba667790>, factory=<AttributeProxy(attribute=<Attribute(type_val=<ClassType(cls=<Rea...(truncated), 
        globals={'Slot': <Shiboken.ObjectType at remote 0x1244e40>, 'Graph': <type at remote 0xfcaff0>, 'rounded_rect': <function at remote 0x7fffeef67848>, 'MultiNodeCopy': <type at remote 0x1233990>, 'rounded_square': <function at remote 0x7fffeef67938>, 'Node': <Shiboken.ObjectType at remote 0x1240620>, 'color_schemes': {'cyan': (<PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cc10>, <PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429ccd0>), 'green': (<PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cbd0>, <PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cc90>), 'yellow': (<PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cc50>, <PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cd10>)}, 'QtGui': <module at remote 0x7ffff41250c0>, 'gradient': <module at remote 0x7fffef81a590>, '__package__': 'ui.graph', 'VISIBLE': 0, 'NodeCopy': <type at remote 0x1244120>, 'get_profile_fp': <function at remote 0x7fffef827a28>, 'GraphView': <Shiboken.ObjectType at remote 0x11d1cd0>, 'INVISIBLE': 1, '__doc__': '\nModule implementing MainW...(truncated), filename=0x5e93d5 "<string>", 
        mod=<optimized out>) at ../Python/pythonrun.c:1376
    #56 PyRun_StringFlags () at ../Python/pythonrun.c:1339
    #57 0x00000000004cdd0f in exec_statement (
        locals={'self': <Node(real_node=<NodeInterface(node=<Operator(on_next=[<instancemethod at remote 0x7fffba67a730>, <instancemethod at remote 0x7fffba291f00>, <instancemethod at remote 0x7fffba291c80>], name=u'Split#9', _attr=<Struct(func=<AttributeProxy(attribute=<Attribute(type_val=<FuncT(val_func=<function at remote 0x7fffefabca28>, name='function', factory_func=None) at remote 0x7fffefae6350>, attr_name='func', streams={}) at remote 0x7fffefaae5d0>, on_error=[], on_end=[], obj=<...>, on_next=[]) at remote 0x7fffba69b550>, name=<AttributeProxy(attribute=<Attribute(type_val=<ClassType(cls=<type at remote 0x9056a0>) at remote 0x7fffefa98e90>, attr_name='name', streams={<Value(on_next=[<instancemethod at remote 0x7fffba67a960>, <instancemethod at remote 0x7fffba67a5a0>], name=u'bool#10', _attr=<Struct(name=<AttributeProxy(attribute=<...>, on_error=[], on_end=[], obj=<...>, on_next=[<function at remote 0x7fffba68e140>]) at remote 0x7fffba667790>, factory=<AttributeProxy(attribute=<Attribute(type_val=<ClassType(cls=<Rea...(truncated), 
        globals={'Slot': <Shiboken.ObjectType at remote 0x1244e40>, 'Graph': <type at remote 0xfcaff0>, 'rounded_rect': <function at remote 0x7fffeef67848>, 'MultiNodeCopy': <type at remote 0x1233990>, 'rounded_square': <function at remote 0x7fffeef67938>, 'Node': <Shiboken.ObjectType at remote 0x1240620>, 'color_schemes': {'cyan': (<PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cc10>, <PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429ccd0>), 'green': (<PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cbd0>, <PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cc90>), 'yellow': (<PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cc50>, <PySide.QtCore.Qt.GlobalColor at remote 0x7ffff429cd10>)}, 'QtGui': <module at remote 0x7ffff41250c0>, 'gradient': <module at remote 0x7fffef81a590>, '__package__': 'ui.graph', 'VISIBLE': 0, 'NodeCopy': <type at remote 0x1244120>, 'get_profile_fp': <function at remote 0x7fffef827a28>, 'GraphView': <Shiboken.ObjectType at remote 0x11d1cd0>, 'INVISIBLE': 1, '__doc__': '\nModule implementing MainW...(truncated), prog=<optimized out>, 
    


  • For the record, the bug is in PySide. I moved to PyQt and except a few differences, the code is the same. No crash at all.
    Sad.


Log in to reply