shiboken segfault, (py) object already deleted

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

shiboken segfault, (py) object already deleted

Post by mlampert »

I get a significant number of segfaults which seem to have to do with objects being ref-counted wrong. Most of them are during shutdown of FC, rarely during operation. The stacktrace looks something like this:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3a100) [0x7f72d5624100]
#1  0x7f72d48c1822 in Shiboken::BindingManager::retrieveWrapper(void const*) from /usr/lib/x86_64-linux-gnu/libshiboken2.cpython-37m-x86_64-linux-gnu.so.5.11+0x12
#2  /usr/lib/x86_64-linux-gnu/libpyside2.cpython-37m-x86_64-linux-gnu.so.5.11(+0x2c795) [0x7f72d4898795]
#3  /usr/lib/x86_64-linux-gnu/libpyside2.cpython-37m-x86_64-linux-gnu.so.5.11(+0x2e167) [0x7f72d489a167]
#4  0x7f72d5c2fb5a in QMetaType::destruct(int, void*) from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0xca
#5  /usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2b863c) [0x7f72d5c5563c]
#6  0x7f72d5c55c97 in QVariant::~QVariant() from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x47
#7  0x7f72d5c43b04 in QObjectPrivate::~QObjectPrivate() from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x314
#8  0x7f72d5c43bf9 in QObjectPrivate::~QObjectPrivate() from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x9
#9  0x7f72d5c4c477 in QObject::~QObject() from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x607
#10  /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5(+0x1aa059) [0x7f72d6082059]
#11  /lib/x86_64-linux-gnu/libc.so.6(+0x3c720) [0x7f72d5626720]
#12  /lib/x86_64-linux-gnu/libc.so.6(+0x3c85a) [0x7f72d562685a]
#13  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf2) [0x7f72d5610bc2]
#14  /home/markus/projects/FreeCAD/dev/build/bin/FreeCAD(_start+0x2a) [0x557004f214ca]
I get a similar issue, although handled gracefully when closing a Path op task panel. This happens quite frequently - I'm not aware of any changes in Path related to this behaviour:

Code: Select all

Traceback (most recent call last):                                                             
  File "/media/sdb/projects/FreeCAD/dev/build/Mod/Path/PathScripts/PathOpGui.py", line 946, in reject                                                                                         
    PathUtil.clearExpressionEngine(self.obj)                                                   
  File "/media/sdb/projects/FreeCAD/dev/build/Mod/Path/PathScripts/PathUtil.py", line 135, in clearExpressionEngine                                                                           
    if hasattr(obj, 'ExpressionEngine'):                                                       
<class 'ReferenceError'>: Cannot access attribute 'ExpressionEngine' of deleted object   
Anybody else seeing this or similar issues?

Code: Select all

OS: Debian GNU/Linux bullseye/sid (LXQt//usr/share/xsessions/lxqt)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19018 +2 (Git)
Build type: Unknown
Branch: feature/toggle-active-cmd-support-for-dressups
Hash: f6d233942ebc6b80109aad23d28af1d3e95a810a
Python version: 3.7.5
Qt version: 5.12.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: C/Default (C)
User avatar
kkremitzki
Veteran
Posts: 2518
Joined: Thu Mar 03, 2016 9:52 pm
Location: Illinois

Re: shiboken segfault, (py) object already deleted

Post by kkremitzki »

The most recent pyside2 upload to Debian Unstable has some shiboken2 related bugs, this might be a manifestation of that. If it's the case you could grab the previous version off e.g. tracker.debian.org and see if recompiling with that version fixes things.
Like my FreeCAD work? I'd appreciate any level of support via Patreon, Liberapay, or PayPal! Read more about what I do at my blog.
mlampert
Veteran
Posts: 1772
Joined: Fri Sep 16, 2016 9:28 pm

Re: shiboken segfault, (py) object already deleted

Post by mlampert »

Not sure when those errors got introduced but this is not a new phenomenon. I'm running testing (not unstable) and these crashes and errors have been happening for a few weeks now.
Post Reply