Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/test_assembly.py::test_colors_assy0[chassis0_assy-expected0] Fatal Python error: Segmentation fault #149

Open
l29ah opened this issue May 13, 2024 · 14 comments

Comments

@l29ah
Copy link

l29ah commented May 13, 2024

I'm packaging CadQuery for Gentoo. I've built OCP with the pre-generated "ubuntu" bindings sources as suggested in #132 (comment)
CadQuery master pytest segfaults in (through?) OCP:

python3.11 -m pytest -vv -ra -l -Wdefault -Werror::pytest.PytestUnhandledCoroutineWarning --color=yes -o console_output_style=count -o tmp_path_retention_count=0 -o tmp_path_retention_policy=failed -p no:cov -p no:flake8 -p no:flakes -p no:pylint -p no:markdown -p no:sugar -p no:xvfb -p no:pytest-describe -p no:plus -p no:tavern -p no:salt-factories
===================================================== test session starts ======================================================
platform linux -- Python 3.11.9, pytest-8.2.0, pluggy-1.5.0 -- /var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999_python3.11/install/usr/bin/python3.11
cachedir: .pytest_cache
rootdir: /var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999
plugins: anyio-4.2.0, pkgcore-0.12.27
collected 576 items                                                                                                            

tests/test_assembly.py::test_metadata PASSED                                                                          [  1/576]
tests/test_assembly.py::test_color PASSED                                                                             [  2/576]
tests/test_assembly.py::test_assembly PASSED                                                                          [  3/576]
tests/test_assembly.py::test_assy_root_name[simple_assy-None] PASSED                                                  [  4/576]
tests/test_assembly.py::test_assy_root_name[nested_assy-TOP] PASSED                                                   [  5/576]
tests/test_assembly.py::test_step_export PASSED                                                                       [  6/576]
tests/test_assembly.py::test_native_export PASSED                                                                     [  7/576]
tests/test_assembly.py::test_vtkjs_export PASSED                                                                      [  8/576]
tests/test_assembly.py::test_vrml_export PASSED                                                                       [  9/576]
tests/test_assembly.py::test_toJSON PASSED                                                                            [ 10/576]
tests/test_assembly.py::test_save[step-args0] PASSED                                                                  [ 11/576]
tests/test_assembly.py::test_save[xml-args1] PASSED                                                                   [ 12/576]
tests/test_assembly.py::test_save[stp-args2] PASSED                                                                   [ 13/576]
tests/test_assembly.py::test_save[caf-args3] PASSED                                                                   [ 14/576]
tests/test_assembly.py::test_save[wrl-args4] PASSED                                                                   [ 15/576]
tests/test_assembly.py::test_save[stl-args5] PASSED                                                                   [ 16/576]
tests/test_assembly.py::test_save_stl_formats PASSED                                                                  [ 17/576]
tests/test_assembly.py::test_save_gltf PASSED                                                                         [ 18/576]
tests/test_assembly.py::test_exportGLTF PASSED                                                                        [ 19/576]
tests/test_assembly.py::test_save_gltf_boxes2 PASSED                                                                  [ 20/576]
tests/test_assembly.py::test_save_vtkjs PASSED                                                                        [ 21/576]
tests/test_assembly.py::test_save_raises PASSED                                                                       [ 22/576]
tests/test_assembly.py::test_leaf_node_count[simple_assy-3] PASSED                                                    [ 23/576]
tests/test_assembly.py::test_leaf_node_count[nested_assy-3] PASSED                                                    [ 24/576]
tests/test_assembly.py::test_leaf_node_count[empty_top_assy-1] PASSED                                                 [ 25/576]
tests/test_assembly.py::test_colors_assy0[chassis0_assy-expected0] Fatal Python error: Segmentation fault

Current thread 0x00007f8d195afe80 (most recent call first):
  File "/var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999/cadquery/occ_impl/shapes.py", line 400 in clean
  File "/var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999/cadquery/cq.py", line 3300 in <listcomp>
  File "/var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999/cadquery/cq.py", line 3299 in _combineWithBase
  File "/var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999/cadquery/cq.py", line 3149 in extrude
  File "/var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999/tests/test_assembly.py", line 309 in chassis0_assy
  File "/usr/lib/python3.11/site-packages/_pytest/fixtures.py", line 884 in call_fixture_func
  File "/usr/lib/python3.11/site-packages/_pytest/fixtures.py", line 1122 in pytest_fixture_setup
  File "/usr/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/usr/lib/python3.11/site-packages/_pytest/fixtures.py", line 1073 in execute
  File "/usr/lib/python3.11/site-packages/_pytest/fixtures.py", line 603 in _get_active_fixturedef
  File "/usr/lib/python3.11/site-packages/_pytest/fixtures.py", line 518 in getfixturevalue
  File "/var/tmp/portage/media-gfx/cadquery-9999/work/cadquery-9999/tests/test_assembly.py", line 804 in test_colors_assy0
  File "/usr/lib/python3.11/site-packages/_pytest/python.py", line 162 in pytest_pyfunc_call
  File "/usr/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/usr/lib/python3.11/site-packages/_pytest/python.py", line 1627 in runtest
  File "/usr/lib/python3.11/site-packages/_pytest/runner.py", line 173 in pytest_runtest_call
  File "/usr/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/usr/lib/python3.11/site-packages/_pytest/runner.py", line 241 in <lambda>
  File "/usr/lib/python3.11/site-packages/_pytest/runner.py", line 341 in from_call
  File "/usr/lib/python3.11/site-packages/_pytest/runner.py", line 240 in call_and_report
  File "/usr/lib/python3.11/site-packages/_pytest/runner.py", line 135 in runtestprotocol
  File "/usr/lib/python3.11/site-packages/_pytest/runner.py", line 116 in pytest_runtest_protocol
  File "/usr/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/usr/lib/python3.11/site-packages/_pytest/main.py", line 364 in pytest_runtestloop
  File "/usr/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/usr/lib/python3.11/site-packages/_pytest/main.py", line 339 in _main
  File "/usr/lib/python3.11/site-packages/_pytest/main.py", line 285 in wrap_session
  File "/usr/lib/python3.11/site-packages/_pytest/main.py", line 332 in pytest_cmdline_main
  File "/usr/lib/python3.11/site-packages/pluggy/_callers.py", line 103 in _multicall
  File "/usr/lib/python3.11/site-packages/pluggy/_manager.py", line 120 in _hookexec
  File "/usr/lib/python3.11/site-packages/pluggy/_hooks.py", line 513 in __call__
  File "/usr/lib/python3.11/site-packages/_pytest/config/__init__.py", line 178 in main
  File "/usr/lib/python3.11/site-packages/_pytest/config/__init__.py", line 206 in console_main
  File "/usr/lib/python3.11/site-packages/pytest/__main__.py", line 7 in <module>
  File "<frozen runpy>", line 88 in _run_code
  File "<frozen runpy>", line 198 in _run_module_as_main

Extension modules: vtkmodules.vtkCommonCore, vtkmodules.vtkCommonMath, vtkmodules.vtkCommonTransforms, vtkmodules.vtkCommonDataModel, vtkmodules.vtkCommonExecutionModel, vtkmodules.vtkCommonMisc, vtkmodules.vtkFiltersCore, numpy.core._multiarray_umath, numpy.core._multiarray_tests, numpy.linalg._umath_linalg, numpy.fft._pocketfft_internal, numpy.random._common, numpy.random.bit_generator, numpy.random._bounded_integers, numpy.random._mt19937, numpy.random.mtrand, numpy.random._philox, numpy.random._pcg64, numpy.random._sfc64, numpy.random._generator, matplotlib._c_internal_utils, PIL._imaging, matplotlib._path, kiwisolver._cext, ezdxf.acc.vector, ezdxf.acc.matrix44, ezdxf.acc.construct, ezdxf.acc.bezier4p, ezdxf.acc.bezier3p, ezdxf.acc.bspline, pandas._libs.tslibs.ccalendar, pandas._libs.tslibs.np_datetime, pandas._libs.tslibs.dtypes, pandas._libs.tslibs.base, pandas._libs.tslibs.nattype, pandas._libs.tslibs.timezones, pandas._libs.tslibs.fields, pandas._libs.tslibs.timedeltas, pandas._libs.tslibs.tzconversion, pandas._libs.tslibs.timestamps, pandas._libs.properties, pandas._libs.tslibs.offsets, pandas._libs.tslibs.strptime, pandas._libs.tslibs.parsing, pandas._libs.tslibs.conversion, pandas._libs.tslibs.period, pandas._libs.tslibs.vectorized, pandas._libs.ops_dispatch, pandas._libs.missing, pandas._libs.hashtable, pandas._libs.algos, pandas._libs.interval, pandas._libs.lib, pandas._libs.ops, numexpr.interpreter, bottleneck.move, bottleneck.nonreduce, bottleneck.nonreduce_axis, bottleneck.reduce, pandas._libs.hashing, pandas._libs.arrays, pandas._libs.tslib, pandas._libs.sparse, pandas._libs.internals, pandas._libs.indexing, pandas._libs.index, pandas._libs.writers, pandas._libs.join, pandas._libs.window.aggregations, pandas._libs.window.indexers, pandas._libs.reshape, pandas._libs.groupby, pandas._libs.json, pandas._libs.parsers, pandas._libs.testing, _nlopt, vtkmodules.vtkIOXMLParser, vtkmodules.vtkIOXML, vtkmodules.vtkRenderingCore, vtkmodules.vtkFiltersGeneral, vtkmodules.vtkFiltersExtraction, casadi._casadi, vtkmodules.vtkIOCore, vtkmodules.vtkImagingCore, vtkmodules.vtkIOImage, vtkmodules.vtkRenderingContext2D, vtkmodules.vtkRenderingFreeType, vtkmodules.vtkRenderingSceneGraph, vtkmodules.vtkRenderingVtkJS, vtkmodules.vtkIOExport, vtkmodules.vtkFiltersSources, vtkmodules.vtkInteractionWidgets, vtkmodules.vtkRenderingAnnotation, vtkmodules.vtkInteractionStyle (total: 94)

gdb on the core dump says:

(gdb) bt
#0  0x00007f8d18ec503c in __pthread_kill_implementation () from /lib64/libc.so.6
#1  0x00007f8d18e75296 in raise () from /lib64/libc.so.6
#2  <signal handler called>
#3  0x00007f8d0893a7d4 in TopoDS_Builder::Add(TopoDS_Shape&, TopoDS_Shape const&) const () from /usr/lib64/opencascade/libTKBRep.so.7.7
#4  0x00007f8d09069bfc in ShapeUpgrade_UnifySameDomain::IntUnifyFaces(TopoDS_Shape const&, NCollection_IndexedDataMap<TopoDS_Shape, NCollection_List<TopoDS_Shape>, TopTools_ShapeMapHasher> const&, NCollection_DataMap<TopoDS_Shape, NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher>, TopTools_ShapeMapHasher> const&, NCollection_Map<TopoDS_Shape, TopTools_ShapeMapHasher> const&) () from /usr/lib64/opencascade/libTKShHealing.so.7.7
#5  0x00007f8d0906cbb2 in ShapeUpgrade_UnifySameDomain::UnifyFaces() () from /usr/lib64/opencascade/libTKShHealing.so.7.7
#6  0x00007f8d0906d688 in ShapeUpgrade_UnifySameDomain::Build() () from /usr/lib64/opencascade/libTKShHealing.so.7.7
#7  0x00007f8d11dd09b7 in pybind11::cpp_function::initialize<pybind11::cpp_function::initialize<void, ShapeUpgrade_UnifySameDomain, , pybind11::name, pybind11::is_method, pybind11::sibling, char [53]>(void (ShapeUpgrade_UnifySameDomain::*)(), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, char const (&) [53])::{lambda(ShapeUpgrade_UnifySameDomain*)#1}, void, ShapeUpgrade_UnifySameDomain*, pybind11::name, pybind11::is_method, pybind11::sibling, char [53]>(pybind11::cpp_function::initialize<void, ShapeUpgrade_UnifySameDomain, , pybind11::name, pybind11::is_method, pybind11::sibling, char [53]>(void (ShapeUpgrade_UnifySameDomain::*)(), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, char const (&) [53])::{lambda(ShapeUpgrade_UnifySameDomain*)#1}&&, void (*)(ShapeUpgrade_UnifySameDomain*), pybind11::name const&, pybind11::is_method const&, pybind11::sibling const&, char const (&) [53])::{lambda(pybind11::detail::function_call&)#1}::_FUN(pybind11::detail::function_call&) () from /usr/lib/python3.11/site-packages/OCP.cpython-311-x86_64-linux-gnu.so
#8  0x00007f8d0d027da3 in pybind11::cpp_function::dispatcher(_object*, _object*, _object*) () from /usr/lib/python3.11/site-packages/OCP.cpython-311-x86_64-linux-gnu.so
#9  0x00007f8d191175d3 in cfunction_call () from /usr/lib64/libpython3.11.so.1.0
#10 0x00007f8d190d34ff in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#11 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#12 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#13 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#14 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#15 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#16 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#17 0x00007f8d190d36db in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#18 0x00007f8d190d3960 in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#19 0x00007f8d19139b34 in slot_tp_call () from /usr/lib64/libpython3.11.so.1.0
#20 0x00007f8d190d34ff in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#21 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#22 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#23 0x00007f8d190d3122 in _PyVectorcall_Call () from /usr/lib64/libpython3.11.so.1.0
#24 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#25 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#26 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#27 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#28 0x00007f8d190d36db in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#29 0x00007f8d190d3960 in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#30 0x00007f8d19139b34 in slot_tp_call () from /usr/lib64/libpython3.11.so.1.0
#31 0x00007f8d190d34ff in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#32 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#33 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#34 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#35 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#36 0x00007f8d190d36db in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#37 0x00007f8d190d3960 in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#38 0x00007f8d19139b34 in slot_tp_call () from /usr/lib64/libpython3.11.so.1.0
#39 0x00007f8d190d32fe in _PyObject_Call () from /usr/lib64/libpython3.11.so.1.0
#40 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#41 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#42 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#43 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#44 0x00007f8d190d36db in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#45 0x00007f8d190d3960 in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#46 0x00007f8d19139b34 in slot_tp_call () from /usr/lib64/libpython3.11.so.1.0
#47 0x00007f8d190d34ff in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#48 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#49 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#50 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#51 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#52 0x00007f8d190d36db in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#53 0x00007f8d190d3960 in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#54 0x00007f8d19139b34 in slot_tp_call () from /usr/lib64/libpython3.11.so.1.0
#55 0x00007f8d190d34ff in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#56 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#57 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#58 0x00007f8d190805d9 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#59 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#60 0x00007f8d190d36db in _PyObject_FastCallDictTstate () from /usr/lib64/libpython3.11.so.1.0
#61 0x00007f8d190d3960 in _PyObject_Call_Prepend () from /usr/lib64/libpython3.11.so.1.0
#62 0x00007f8d19139b34 in slot_tp_call () from /usr/lib64/libpython3.11.so.1.0
#63 0x00007f8d190d34ff in _PyObject_MakeTpCall () from /usr/lib64/libpython3.11.so.1.0
#64 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#65 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#66 0x00007f8d191afcb1 in PyEval_EvalCode () from /usr/lib64/libpython3.11.so.1.0
#67 0x00007f8d191a7c20 in builtin_exec () from /usr/lib64/libpython3.11.so.1.0
#68 0x00007f8d191176c6 in cfunction_vectorcall_FASTCALL_KEYWORDS () from /usr/lib64/libpython3.11.so.1.0
#69 0x00007f8d190d3ad7 in PyObject_Vectorcall () from /usr/lib64/libpython3.11.so.1.0
#70 0x00007f8d190864e3 in _PyEval_EvalFrameDefault () from /usr/lib64/libpython3.11.so.1.0
#71 0x00007f8d191afbf0 in _PyEval_Vector () from /usr/lib64/libpython3.11.so.1.0
#72 0x00007f8d1921174a in pymain_run_module () from /usr/lib64/libpython3.11.so.1.0
#73 0x00007f8d19211f3a in Py_RunMain () from /usr/lib64/libpython3.11.so.1.0
#74 0x00007f8d1921272b in Py_BytesMain () from /usr/lib64/libpython3.11.so.1.0
#75 0x00007f8d18e5f2e0 in __libc_start_call_main () from /lib64/libc.so.6
#76 0x00007f8d18e5f399 in __libc_start_main () from /lib64/libc.so.6
#77 0x00005617a6166095 in _start ()

How do i address this?

@adam-urbanczyk
Copy link
Member

Would you be able to step through the failing test in python share the object (as brep) passed to ShapeUpgrade_UnifySameDomain?

@l29ah
Copy link
Author

l29ah commented May 14, 2024

I don't understand what you're asking me to provide. There're more than two segfaulting tests, as i'm commenting them out. Is your request about testBrepImportExport, or about the first crashing test context, or something else?

@adam-urbanczyk
Copy link
Member

So the idea was that you debug (in pdb) the first segfaulting test and share the problematic shape as a brep file. BTW: how is OCCT compiled? Can you share the flags passed to cmake?

@l29ah
Copy link
Author

l29ah commented May 17, 2024

It's compiled by a Gentoo ebuild. cmake -C /var/tmp/portage/sci-libs/opencascade-7.7.2-r1/work/OCCT-7_7_2_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -D3RDPARTY_DIR=/usr -DBUILD_CPP_STANDARD=C++17 -DBUILD_SOVERSION_NUMBERS=2 -DBUILD_DOC_Overview=no -DBUILD_Inspector=no -DBUILD_ENABLE_FPE_SIGNAL_HANDLER=no -DBUILD_USE_PCH=no -DBUILD_RELEASE_DISABLE_EXCEPTIONS=no -DINSTALL_DIR=/usr -DINSTALL_DIR_BIN=lib64/opencascade/bin -DINSTALL_DIR_CMAKE=lib64/cmake/opencascade -DINSTALL_DIR_DATA=share/opencascade/data -DINSTALL_DIR_DOC=share/doc/opencascade-7.7.2-r1 -DINSTALL_DIR_INCLUDE=include/opencascade -DINSTALL_DIR_LIB=lib64/opencascade -DINSTALL_DIR_RESOURCE=share/opencascade/resources -DINSTALL_DIR_SAMPLES=share/opencascade/samples -DINSTALL_DIR_SCRIPT=lib64/opencascade/bin -DINSTALL_DIR_TESTS=share/opencascade/tests -DINSTALL_DIR_WITH_VERSION=no -DINSTALL_SAMPLES=no -DINSTALL_TEST_CASES=no -DUSE_DRACO=no -DUSE_FFMPEG=no -DUSE_FREEIMAGE=no -DUSE_FREETYPE=no -DUSE_GLES2=no -DUSE_OPENGL=yes -DUSE_OPENVR=no -DUSE_RAPIDJSON=yes -DUSE_TBB=no -DUSE_TK=no -DUSE_VTK=yes -DUSE_XLIB=yes -D3RDPARTY_VTK_INCLUDE_DIR=/usr/include/vtk-9.3 -D3RDPARTY_VTK_LIBRARY_DIR=/usr/lib64 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/sci-libs/opencascade-7.7.2-r1/work/OCCT-7_7_2_build/gentoo_toolchain.cmake /var/tmp/portage/sci-libs/opencascade-7.7.2-r1/work/OCCT-7_7_2

Will try with pdb in a while.

@l29ah
Copy link
Author

l29ah commented May 17, 2024

I failed to export brep, but produced a minimal segfault reproducer:

#!/usr/bin/python3
import cadquery as cq

r_wheel = 25
w_wheel = 10
wheel = cq.Workplane("YZ").circle(r_wheel).extrude(w_wheel, both=True)
wheel.val().exportBrep("wheel.brep")

@adam-urbanczyk
Copy link
Member

That does not look too weird. I assume that cq.Workplane("YZ").circle(r_wheel).extrude(w_wheel, both=True, clean=False) does not segfault, right?

Looking at your cmake flags, -DBUILD_ENABLE_FPE_SIGNAL_HANDLER=no might be suspicious. I never unset it, could you check what happens without it?

@l29ah
Copy link
Author

l29ah commented May 17, 2024 via email

@l29ah
Copy link
Author

l29ah commented May 17, 2024

Looking at your cmake flags, -DBUILD_ENABLE_FPE_SIGNAL_HANDLER=no might be suspicious. I never unset it, could you check what happens without it?

No effect.

@adam-urbanczyk
Copy link
Member

OK, could you then check with a debug build of OCCT and share the coredump?

@l29ah
Copy link
Author

l29ah commented May 17, 2024 via email

@adam-urbanczyk
Copy link
Member

AFAICT this is null and that is the direct cause of the behavior. I'm not sure what to make out of this. Two random ideas:
(1) does changing of the toolchain help (i.e. gcc instead of clang)?
(2) what is actually added in #3 ShapeUpgrade_UnifySameDomain.cxx:3613? Is CurEdge null (CurEdge.IsNull())?

@erooke
Copy link

erooke commented Oct 11, 2024

For any future travelers: this was fixed for me by applying the blobfish patch. For some reason the new set of patches does not seem to fix it.

@l29ah
Copy link
Author

l29ah commented Oct 13, 2024

For any future travelers: this was fixed for me by applying the blobfish patch. For some reason the new set of patches does not seem to fix it.

Indeed, this patch fixes the segfaults for me, thank you for your nicely-documented investigation (erooke/ocp.nix#2)!
I hope CadQuery will stop depending on patched opencascade in the future, as now it makes it really awkward to package it anywhere but in NixOS-like distros perhaps, since other software (like freecad, kicad, prusaslicer) would likely prefer/require vanilla opencascade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants