BUG: SIGSEGV on create surface (SurfaceWB)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
HardRock
Posts: 83
Joined: Tue Mar 13, 2018 5:50 am
Location: Russian Federation

BUG: SIGSEGV on create surface (SurfaceWB)

Postby HardRock » Wed Jan 13, 2021 7:12 pm

There is two faces (simple copy from ruled surface) and two edges between them.

1. Go to Surface WB, use "Create a surface from two, three or four boundary edges"
2. Add "Edge_Upper"
3. Add "Edge_Lower"

Preview of surface between edges will apper.

4. Add nearest edge of "Surface_A"

FreeCAD will crash with SIGSEGV at

Code: Select all

Thread 1 "freecad-daily" received signal SIGSEGV, Segmentation fault.
0x00007fffb8fa74b0 in Geom_TrimmedCurve::Geom_TrimmedCurve(opencascade::handle<Geom_Curve> const&, double, double, bool, bool) ()
   from /usr/lib/x86_64-linux-gnu/libTKG3d.so.7
(gdb) bt
#0  0x00007fffb8fa74b0 in Geom_TrimmedCurve::Geom_TrimmedCurve(opencascade::handle<Geom_Curve> const&, double, double, bool, bool) ()
    at /usr/lib/x86_64-linux-gnu/libTKG3d.so.7
#1  0x00007fff379e6fd5 in Surface::GeomFillSurface::createBSplineSurface(TopoDS_Wire&) () at /usr/lib/freecad-daily-python3/lib/Surface.so
#2  0x00007fff379e75db in Surface::GeomFillSurface::execute() () at /usr/lib/freecad-daily-python3/lib/Surface.so
#3  0x00007ffff64eb42a in App::DocumentObject::recompute() () at /usr/lib/freecad-daily-python3/lib/libFreeCADApp.so
#4  0x00007fffba10e8eb in Part::Feature::recompute() () at /usr/lib/freecad-daily-python3/lib/Part.so
#5  0x00007ffff6480e6c in App::Document::_recomputeFeature(App::DocumentObject*) () at /usr/lib/freecad-daily-python3/lib/libFreeCADApp.so
#6  0x00007ffff6496b03 in App::Document::recomputeFeature(App::DocumentObject*, bool) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADApp.so
#7  0x00007fff37796d2c in SurfaceGui::GeomFillSurface::onSelectionChanged(Gui::SelectionChanges const&) ()
    at /usr/lib/freecad-daily-python3/lib/SurfaceGui.so
#8  0x00007ffff724f2fe in Gui::SelectionObserver::_onSelectionChanged(Gui::SelectionChanges const&) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#9  0x00007ffff6fe0d2f in boost::signals2::detail::signal_impl<void (Gui::SelectionChanges const&), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (Gui::SelectionChanges const&)>, boost::function<void (boost::signals2::connection const&, Gui::SelectionChanges const&)>, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#10 0x00007ffff72573b5 in Gui::SelectionSingleton::slotSelectionChanged(Gui::SelectionChanges const&) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#11 0x00007ffff6fe0d2f in boost::signals2::detail::signal_impl<void (Gui::SelectionChanges const&), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void (Gui::SelectionChanges const&)>, boost::function<void (boost::signals2::connection const&, Gui::SelectionChanges const&)>, boost::signals2::mutex>::operator()(Gui::SelectionChanges const&) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#12 0x00007ffff7258095 in Gui::SelectionSingleton::notify(Gui::SelectionChanges&&) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#13 0x00007ffff7260ffb in Gui::SelectionSingleton::addSelection(char const*, char const*, char const*, float, float, float, std::vector<Gui::SelectionSingleton::SelObj, std::allocator<Gui::SelectionSingleton::SelObj> > const*, bool) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#14 0x00007ffff7060e5f in Gui::SoFCUnifiedSelection::setSelection(std::vector<Gui::SoFCUnifiedSelection::PickedInfo, std::allocator<Gui::SoFCUnifiedSelection::PickedInfo> > const&, bool) () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#15 0x00007ffff7062331 in Gui::SoFCUnifiedSelection::handleEvent(SoHandleEventAction*) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#16 0x00007ffff2c41504 in SoAction::traverse(SoNode*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#17 0x00007ffff2de1008 in SoChildList::traverse(SoAction*, int, int) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#18 0x00007ffff2e304e6 in SoGroup::doAction(SoAction*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#19 0x00007ffff2e4a967 in SoSeparator::doAction(SoAction*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#20 0x00007ffff2c41504 in SoAction::traverse(SoNode*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#21 0x00007ffff2c4ae48 in SoHandleEventAction::beginTraversal(SoNode*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#22 0x00007ffff2c41a82 in SoAction::apply(SoNode*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#23 0x00007ffff2dfd8a0 in SoEventManager::actuallyProcessEvent(SoEvent const*) () at /usr/lib/x86_64-linux-gnu/libCoin.so.80c
#24 0x00007ffff70e280e in SIM::Coin3D::Quarter::QuarterWidget::processSoEvent(SoEvent const*) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#25 0x00007ffff70eac66 in SIM::Coin3D::Quarter::SoQTQuarterAdaptor::processSoEvent(SoEvent const*) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#26 0x00007ffff7122e69 in Gui::View3DInventorViewer::processSoEventBase(SoEvent const*) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#27 0x00007ffff70f28ac in Gui::NavigationStyle::processSoEvent(SoEvent const*) () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#28 0x00007ffff70f84bb in Gui::CADNavigationStyle::processSoEvent(SoEvent const*) () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#29 0x00007ffff70f4e33 in Gui::NavigationStyle::processEvent(SoEvent const*) () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#30 0x00007ffff7122de3 in Gui::View3DInventorViewer::processSoEvent(SoEvent const*) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#31 0x00007ffff70d9bf5 in SIM::Coin3D::Quarter::EventFilter::eventFilter(QObject*, QEvent*) ()
    at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#32 0x00007ffff44345bc in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
---Type <return> to continue, or q <return> to quit---
   re.so.5
#33 0x00007ffff51b2815 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#34 0x00007ffff51ba65f in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#35 0x00007ffff6e28848 in Gui::GUIApplication::notify(QObject*, QEvent*) () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#36 0x00007ffff44348d8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x00007ffff51b9632 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#38 0x00007ffff520c16b in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#39 0x00007ffff520e7da in  () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#40 0x00007ffff51b283c in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#41 0x00007ffff51ba104 in QApplication::notify(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5
#42 0x00007ffff6e28848 in Gui::GUIApplication::notify(QObject*, QEvent*) () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#43 0x00007ffff44348d8 in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#44 0x00007ffff49f6583 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#45 0x00007ffff49f8055 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#46 0x00007ffff49cf2eb in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Gui.so.5
#47 0x00007fffe4869260 in  () at /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#48 0x00007fffeeb50417 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#49 0x00007fffeeb50650 in  () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#50 0x00007fffeeb506dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0
#51 0x00007ffff448d88f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#52 0x00007ffff443290a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#53 0x00007ffff443b9b4 in QCoreApplication::exec() () at /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#54 0x00007ffff6d96e99 in Gui::Application::runApplication() () at /usr/lib/freecad-daily-python3/lib/libFreeCADGui.so
#55 0x0000555555557562 in  ()
#56 0x00007ffff3839b97 in __libc_start_main (main=0x555555556e60, argc=1, argv=0x7fffffffdbd8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffdbc8)
    at ../csu/libc-start.c:310
#57 0x000055555555828a in  ()

OS: Ubuntu 18.04.4 LTS (Unity:Unity7:ubuntu/unity)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 6b3936c8b8859f8d45a1f3e9859ef7e7bde5b271
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Russian/Russia (ru_RU)
Attachments
bug_crash.FCStd
(45.39 KiB) Downloaded 6 times
kisolre
Posts: 2998
Joined: Wed Nov 21, 2018 1:13 pm

Re: BUG: SIGSEGV on create surface (SurfaceWB)

Postby kisolre » Wed Jan 13, 2021 7:39 pm

I get "Illegal storage access" under windows. Also using "Create surface from picked boundary edges" creates weird result and again causes "illegal storage" after some clicking around.
But Check Geometry gives errors on all elements - selfintersecting and too small edges. How did you create those edges/shapes?

OS: Windows 8.1 Version 6.3 (Build 9600)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.23683 (Git)
Build type: Release
Branch: master
Hash: af4de262e326452fd79f036253cf7cac6a7e7e00
Python version: 3.8.6+
Qt version: 5.15.1
Coin version: 4.0.1
OCC version: 7.5.0
Locale: Bulgarian/Bulgaria (bg_BG)
HardRock
Posts: 83
Joined: Tue Mar 13, 2018 5:50 am
Location: Russian Federation

Re: BUG: SIGSEGV on create surface (SurfaceWB)

Postby HardRock » Wed Jan 13, 2021 7:58 pm

This is a product of normal operations under objects with completly good geometry.

The main problem of FreeCAD is "making invalid geometry from valid after usual operations". I found that tolerance always increasing after operations and may become really big, this leads to geometry errors like "small edge" (when tolerance bigger than geometry size) and probably another problems.
But this is another topic for discussion. Here we have crash that should not be even if geometry "broken".

Problem edges was copy-pasted from my project
Image

First i have tried to stretch surfaces between hole in wing shell and internal plate and found than FreeCAD crashed.
Then i have launched FreeCAD under GDB to get crash stacktrace for bug report.

And then I have found workaround - extrude plate, cut by wing surface and extract side faces, that was merged using "Draft Upgrade" with other surfaces.
kisolre
Posts: 2998
Joined: Wed Nov 21, 2018 1:13 pm

Re: BUG: SIGSEGV on create surface (SurfaceWB)

Postby kisolre » Wed Jan 13, 2021 8:57 pm

I am not sure about those tolerance values, how they are calculated, stored, used...
Could you extract a simple version of that wing that creates those edges and still exhibits the error?
User avatar
Chris_G
Posts: 1581
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: BUG: SIGSEGV on create surface (SurfaceWB)

Postby Chris_G » Wed Jan 13, 2021 9:35 pm

The small edges of Surface_A and Surface_B have undefined Curve type.
When clicking these edges with GeomInfo, from CurvesWB, I get this message in report view :

Code: Select all

22:27:35  Traceback (most recent call last):
  File "/home/tomate/.FreeCAD/Mod/CurvesWB/freecad/Curves/GeomInfo.py", line 437, in addSelection
    self.getTopo()
  File "/home/tomate/.FreeCAD/Mod/CurvesWB/freecad/Curves/GeomInfo.py", line 598, in getTopo
    cur = self.ss.Curve
<class 'TypeError'>: undefined curve type
I would be curious to know what operation did generate these edges.
HardRock
Posts: 83
Joined: Tue Mar 13, 2018 5:50 am
Location: Russian Federation

Re: BUG: SIGSEGV on create surface (SurfaceWB)

Postby HardRock » Thu Jan 14, 2021 4:51 pm

I can't reproduce problem edges from original part using same workflow, now it shows different problems, but no SIGSEGV :?
The hole in the shell was made by slice with extrude from sketch (not solid)
Surface_A and Surface_B - ruled surfaces between hole edges and sketch edges, then simple copy.
Edge_Lower and Edge_Upper - extracted with Defeaturing Tools.
First time SIGSEGV was catched on ruled surfaces and original edges.