Segmentation fault running test MeshTestsApp.PivyTestCases on archlinux

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
Post Reply
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Segmentation fault running test MeshTestsApp.PivyTestCases on archlinux

Post by adrianinsaval »

with:

Code: Select all

OS: Linux 5.18.15-arch1-1 (KDE/plasma)
Word size of FreeCAD: 64-bit
Version: 0.21.29967 (Git)
Build type: None
Branch: master
Hash: 43dcbe4a315171b62642a95a0e54ba1c394edab5
Python 3.10.5, Qt 5.15.5, Coin 4.0.1, Vtk 9.1.0, OCC 7.5.3
Locale: C/Default (C) [ OS: English/United Kingdom (en_GB) ]
Installed mods: 
  * fasteners 0.3.50
  * Assembly3 0.11.3
  * CfdOF 1.17.4
  * Plot 2022.4.17
  * Curves 0.5.2
  * DynamicData 2.46.0
  * Dracula 0.0.2
  * SelectorToolbar
  * FC_SU
  * A2plus 0.4.56a
  * AirPlaneDesign
  * Glass
  * Assembly4 0.12.3
  * CurvedShapes 1.0.3
  * CubeMenu
  * sheetmetal 0.2.51
I get this when running FreeCAD --run-test MeshTestsApp.PivyTestCases, actually got it running --run-test 0 first but that is the test that crashes.

Code: Select all

testPrimitiveCount (MeshTestsApp.PivyTestCases) ... ok
Program received signal SIGSEGV, Segmentation fault.
#0  /usr/lib/libc.so.6(+0x38a40) [0x7f5892e54a40]
#1  /usr/lib/python3.10/site-packages/pivy/_coin.cpython-310-x86_64-linux-gnu.so(+0x1b65a4) [0x7f5839fb65a4]
#2  0x7f5839fb76c7 in cast_internal(_object*, _object*, char const*, int) from /usr/lib/python3.10/site-packages/pivy/_coin.cpython-310-x86_64-linux-gnu.so+0x87
#3  0x7f5839fb77e3 in cast(_object*, _object*) from /usr/lib/python3.10/site-packages/pivy/_coin.cpython-310-x86_64-linux-gnu.so+0x63
#4  /usr/lib/libpython3.10.so.1.0(+0x155748) [0x7f5894b55748]
#5  /usr/lib/libpython3.10.so.1.0(_PyObject_MakeTpCall+0x2ab) [0x7f5894b4efdb]
#6  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x575a) [0x7f5894b4a38a]
#7  /usr/lib/libpython3.10.so.1.0(+0x161086) [0x7f5894b61086]
#8  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x346) [0x7f5894b44f76]
#9  /usr/lib/libpython3.10.so.1.0(_PyFunction_Vectorcall+0x79) [0x7f5894b55bd9]
#10  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x77a) [0x7f5894b453aa]
#11  /usr/lib/libpython3.10.so.1.0(+0x143bc0) [0x7f5894b43bc0]
#12  /usr/lib/libpython3.10.so.1.0(+0x1611ad) [0x7f5894b611ad]
#13  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x3095) [0x7f5894b47cc5]
#14  /usr/lib/libpython3.10.so.1.0(_PyObject_FastCallDictTstate+0xdb) [0x7f5894b4e2cb]
#15  /usr/lib/libpython3.10.so.1.0(_PyObject_Call_Prepend+0x6d) [0x7f5894b5e8ed]
#16  /usr/lib/libpython3.10.so.1.0(+0x22be32) [0x7f5894c2be32]
#17  /usr/lib/libpython3.10.so.1.0(_PyObject_MakeTpCall+0x2ab) [0x7f5894b4efdb]
#18  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x5164) [0x7f5894b49d94]
#19  /usr/lib/libpython3.10.so.1.0(+0x143bc0) [0x7f5894b43bc0]
#20  /usr/lib/libpython3.10.so.1.0(+0x1611ad) [0x7f5894b611ad]
#21  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x3095) [0x7f5894b47cc5]
#22  /usr/lib/libpython3.10.so.1.0(_PyObject_FastCallDictTstate+0xdb) [0x7f5894b4e2cb]
#23  /usr/lib/libpython3.10.so.1.0(_PyObject_Call_Prepend+0x6d) [0x7f5894b5e8ed]
#24  /usr/lib/libpython3.10.so.1.0(+0x22be32) [0x7f5894c2be32]
#25  /usr/lib/libpython3.10.so.1.0(_PyObject_MakeTpCall+0x2ab) [0x7f5894b4efdb]
#26  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x5164) [0x7f5894b49d94]
#27  /usr/lib/libpython3.10.so.1.0(_PyFunction_Vectorcall+0x79) [0x7f5894b55bd9]
#28  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x77a) [0x7f5894b453aa]
#29  /usr/lib/libpython3.10.so.1.0(_PyFunction_Vectorcall+0x79) [0x7f5894b55bd9]
#30  /usr/lib/libpython3.10.so.1.0(_PyEval_EvalFrameDefault+0x4ebf) [0x7f5894b49aef]
#31  /usr/lib/libpython3.10.so.1.0(+0x143bc0) [0x7f5894b43bc0]
#32  /usr/lib/libpython3.10.so.1.0(PyEval_EvalCode+0x94) [0x7f5894bf40e4]
#33  /usr/lib/libpython3.10.so.1.0(+0x203b63) [0x7f5894c03b63]
#34  /usr/lib/libpython3.10.so.1.0(+0x1ff4fa) [0x7f5894bff4fa]
#35  /usr/lib/libpython3.10.so.1.0(PyRun_StringFlags+0x81) [0x7f5894bf7271]
#36  0x7f5894f040e0 in Base::InterpreterSingleton::runString[abi:cxx11](char const*) from /usr/lib/freecad/lib/libFreeCADBase.so+0x70
#37  0x7f589639b436 in Gui::MainWindow::delayedStartup() from /usr/lib/freecad/lib/libFreeCADGui.so+0x376
#38  0x7f58936b0440 in QObject::event(QEvent*) from /usr/lib/libQt5Core.so.5+0x230
#39  0x7f5894378b3c in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib/libQt5Widgets.so.5+0x9c
#40  0x7f5895f54a21 in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib/freecad/lib/libFreeCADGui.so+0x91
#41  0x7f589368cad8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /usr/lib/libQt5Core.so.5+0x128
#42  0x7f589368d5e3 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) from /usr/lib/libQt5Core.so.5+0x193
#43  /usr/lib/libQt5Core.so.5(+0x2d3548) [0x7f58936d3548]
#44  /usr/lib/libglib-2.0.so.0(g_main_context_dispatch+0x19b) [0x7f5891918c6b]
#45  /usr/lib/libglib-2.0.so.0(+0xab001) [0x7f589196f001]
#46  /usr/lib/libglib-2.0.so.0(g_main_context_iteration+0x32) [0x7f5891916392]
#47  0x7f58936d732c in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/libQt5Core.so.5+0x6c
#48  0x7f589368527c in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/libQt5Core.so.5+0x12c
#49  0x7f589368fda9 in QCoreApplication::exec() from /usr/lib/libQt5Core.so.5+0x99
#50  0x7f5895e9e5bf in Gui::Application::runApplication() from /usr/lib/freecad/lib/libFreeCADGui.so+0x1b9f
#51  FreeCAD(+0x64df) [0x559d31ef54df]
#52  /usr/lib/libc.so.6(+0x232d0) [0x7f5892e3f2d0]
#53  /usr/lib/libc.so.6(__libc_start_main+0x8a) [0x7f5892e3f38a]
#54  FreeCAD(+0x6815) [0x559d31ef5815]
testRayPick (MeshTestsApp.PivyTestCases) ... %
Any clues? pivy version is 0.6.7
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Segmentation fault running test MeshTestsApp.PivyTestCases on archlinux

Post by looo »

wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Segmentation fault running test MeshTestsApp.PivyTestCases on archlinux

Post by wmayer »

It's quite a surprise that the crash also occurs with Py 3.10 because according to https://github.com/coin3d/pivy/commit/4 ... 9a55eb9792 the PR was supposed to fix the crash for this Py version.

In this thread we have figured out that at least for older Py version the change is a regression: https://forum.freecadweb.org/viewtopic. ... 00#p602100
wmayer
Founder
Posts: 20243
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Segmentation fault running test MeshTestsApp.PivyTestCases on archlinux

Post by wmayer »

I have created a debug build with gcc and when running the snippet

Code: Select all

from pivy import coin
det = coin.SoFaceDetail()
coin.cast(det, "SoFaceDetail")
to debug the function cast(PyObject * self, PyObject * args) there is something weird. After the line

Code: Select all

if (!PyArg_ParseTuple(args, "Os#:cast", &obj, &type_name, &type_len)) {
was executed then the debugger shows a valid value of obj and correctly shows 12 for type_len but claims that the address for type_name cannot be accessed.

When debugging inside the cast_internal(PyObject * self, PyObject * obj, const char * type_name, int type_len) then the crash happens in line strncpy(ptr_type, type_name, type_len); because of the corrupted type_name.
Post Reply