FreeCAD fails SIGSEGV, some pivy tests/ FAIL, one fails with SIGSEGV
yopito opened this issue · 7 comments
hello, while packaging FreeCAD 0.20, I have numerous SIGSEGV on FreeCAD's runtime (build is fine)
I suspect some troubles with pivy or coin3, but I'm unsure.
Context: VoidLinux on x86_64, musl libc, python 3.10.5, pyside2 5.15.5, coin3 4.0.0, pivy 0.6.7
FreeCAD failure that make me think of coin3/pivy problem:
$ gdb --args FreeCAD -t MeshTestsApp
(gdb) run
....
testPrimitiveCount (MeshTestsApp.PivyTestCases) ... ok
[New LWP 10712]
Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0x00007ffff7fb2d87 in __stpncpy (d=d@entry=0x555557c44b80 "", s=s@entry=0x7fff00000000 <error: Cannot access memory at address 0x7fff00000000>, n=n@entry=12) at src/string/stpncpy.c:18
18 src/string/stpncpy.c: No such file or directory.
(gdb) bt
#0 0x00007ffff7fb2d87 in __stpncpy (d=d@entry=0x555557c44b80 "",
s=s@entry=0x7fff00000000 <error: Cannot access memory at address 0x7fff00000000>, n=n@entry=12) at src/string/stpncpy.c:18
#1 0x00007ffff7fb356a in strncpy (d=d@entry=0x555557c44b80 "",
s=s@entry=0x7fff00000000 <error: Cannot access memory at address 0x7fff00000000>, n=n@entry=12) at src/string/strncpy.c:5
#2 0x00007fffe15c107a in cast_internal (self=self@entry=0x7fffe1ace4d0, obj=0x7fff6a9472b0,
type_name=0x7fff00000000 <error: Cannot access memory at address 0x7fff00000000>, type_len=12) at pivy/coinPYTHON_wrap.cxx:4289
#3 0x00007fffe15c11cf in cast (self=0x7fffe1ace4d0, args=<optimized out>) at pivy/coinPYTHON_wrap.cxx:4329
#4 0x00007ffff634c734 in ?? () from /lib/libpython3.10.so.1.0
#5 0x00007ffff630f425 in _PyObject_MakeTpCall () from /lib/libpython3.10.so.1.0
#6 0x00007ffff62c4dbb in _PyEval_EvalFrameDefault () from /lib/libpython3.10.so.1.0
#7 0x00007ffff63d6144 in ?? () from /lib/libpython3.10.so.1.0
#8 0x00007ffff6311f38 in ?? () from /lib/libpython3.10.so.1.0
#9 0x00007ffff62c4184 in _PyEval_EvalFrameDefault () from /lib/libpython3.10.so.1.0
#10 0x00007ffff63d6144 in ?? () from /lib/libpython3.10.so.1.0
#11 0x00007ffff62c4038 in _PyEval_EvalFrameDefault () from /lib/libpython3.10.so.1.0
...
So I ran tests/ from pivy with various results:
$ python /build/void/masterdir/builddir/pivy-0.6.7/tests/coin_tests.py
....
----------------------------------------------------------------------
Ran 94 tests in 0.030s
OK
$ python /build/void/masterdir/builddir/pivy-0.6.7/tests/pyside_test.py
testAdresses (__main__.ShibokenTests) ... CppPointer to an instance of PySide.QtCore.QObject = 0x000055F3F152CE00
OverflowError: int too big to convert
/build/void/masterdir/builddir/pivy-0.6.7/tests/pyside_test.py:28: RuntimeWarning: libshiboken: Overflow: Value 18446744073709551615 exceeds limits of type [unsigned] "m" (8bytes).
wrapper.wrapInstance(0xFFFFFFFFFFFFFFFF, QtCore.QObject)
ERROR
======================================================================
ERROR: testAdresses (__main__.ShibokenTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/build/void/masterdir/builddir/pivy-0.6.7/tests/pyside_test.py", line 28, in testAdresses
wrapper.wrapInstance(0xFFFFFFFFFFFFFFFF, QtCore.QObject)
OverflowError
----------------------------------------------------------------------
Ran 1 test in 0.001s
FAILED (errors=1)
$ python /build/void/masterdir/builddir/pivy-0.6.7/tests/quarter_tests.py
.
----------------------------------------------------------------------
Ran 1 test in 0.000s
OK
$ python /build/void/masterdir/builddir/pivy-0.6.7/tests/visual_test.py
Segmentation fault
Reusing content of pivy-0.6.7/tests/visual_test.py
:
$ python
Python 3.10.5 (main, Jun 8 2022, 02:00:39) [GCC 10.2.1 20201203] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from PySide2 import QtWidgets
>>> from pivy import coin, quarter
>>> app = QtWidgets.QApplication(sys.argv)
>>> viewer = quarter.QuarterWidget()
Segmentation fault
any thoughts ?
using pdb on https://github.com/coin3d/pivy/blob/master/pivy/quarter/QuarterWidget.py:
...
(Pdb) n
> /usr/lib/python3.10/site-packages/pivy/quarter/QuarterWidget.py(226)__init__()
-> if statemachine and statemachine.isOfType(coin.SoScXMLStateMachine.getClassTypeId()):
(Pdb) l
221 # callbacks which depends on other state being initialized
222 self.eventmanager = EventManager(self)
223 self.devicemanager = DeviceManager(self)
224
225 statemachine = coin.ScXML.readFile(values["scxml"])
226 -> if statemachine and statemachine.isOfType(coin.SoScXMLStateMachine.getClassTypeId()):
227 sostatemachine = coin.cast(statemachine, "SoScXMLStateMachine")
228 statemachine.addStateChangeCallback(statechangeCB, self)
229 self.soeventmanager.addSoScXMLStateMachine(sostatemachine)
230 sostatemachine.initialize()
231 else:
(Pdb) p statemachine
<pivy.coin.ScXMLStateMachine; proxy of <Swig Object of type 'ScXMLStateMachine *' at 0x7f813bd02cd0> >
(Pdb) p statemachine.isOfType(coin.SoScXMLStateMachine.getClassTypeId())
1
> /usr/lib/python3.10/site-packages/pivy/quarter/QuarterWidget.py(227)__init__()->None
-> sostatemachine = coin.cast(statemachine, "SoScXMLStateMachine")
(Pdb) n
SystemError: <built-in function cast> returned NULL without setting an exception
On Gentoo opencascade fails to build with musl[1][2]. I wonder if this errors might be related to musl as well?
[1] https://bugs.gentoo.org/832742
[2] https://dev.opencascade.org/content/support-different-libc-implementations-linux
IMHO, not relevant: this issue is a runtime problem, not a build one. and related packages are fine with musl.
I suspect some troubles with pivy or coin3, but I'm unsure.
Yes, it's an issue with pivy's coin.cast function. This function has been re-implemented recently to fix another issue but causes a segmentation fault now.
For more details see: #91 (comment)
@wwmayer : ah, ok. thanks for pointing this. hope that someone can fix this (my C++ knowledge is inexistant).
See #99