Closed m-sundman closed 8 months ago
I'm also experiencing frequent crashes (segfaults) with mostly coincident and symmetry constraints in sketcher. A stack trace in the console from one of them is below.
OS: Ubuntu Core 20 (sway/sway)
Word size of FreeCAD: 64-bit
Version: 2023.1231.0.38924 (Git) Snap 122
Build type: Release
Branch: tag: 20231231tip
Hash: 7471b6a2720ee4973b9477a55713070b056c42e8
Python 3.8.10, Qt 5.15.7, Coin 4.0.1, Vtk 7.1.1, OCC 7.6.3
Locale: English/United States (en_US)
Installed mods:
* Assembly3 0.12.0
* Curves 0.6.15
* fasteners 0.4.71
Program received signal SIGSEGV, Segmentation fault.
#0 /lib/x86_64-linux-gnu/libc.so.6(+0x43090) [0x7f4def1cb090]
#1 0x7f4ce66fd7f0 in SketcherGui::ViewProviderSketch::drawConstraintIcons() from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0x7e0
#2 0x7f4ce66fe3e1 in SketcherGui::ViewProviderSketch::onSelectionChanged(Gui::SelectionChanges const&) from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0x241
#3 0x7f4df27d6ea4 in Gui::SelectionObserver::_onSelectionChanged(Gui::SelectionChanges const&) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x34
#4 0x7f4df23ee25f 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&) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x38f
#5 0x7f4df27d6f56 in Gui::SelectionSingleton::slotSelectionChanged(Gui::SelectionChanges const&) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x76
#6 0x7f4df23ee25f 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&) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x38f
#7 0x7f4df27d84bc in Gui::SelectionSingleton::notify(Gui::SelectionChanges&&) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x48c
#8 0x7f4df27d9745 in Gui::SelectionSingleton::clearCompleteSelection(bool) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x485
#9 0x7f4df27d9ede in Gui::SelectionSingleton::clearSelection(char const*, bool) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x54e
#10 0x7f4ce66c0d5d in SketcherGui::TaskSketcherElements::on_elementsWidget_itemSelectionChanged() from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0x11d
#11 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2ec654) [0x7f4df008d654]
#12 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x466a86) [0x7f4df0edba86]
#13 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x46c2c9) [0x7f4df0ee12c9]
#14 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2ec654) [0x7f4df008d654]
#15 0x7f4df0006f74 in QItemSelectionModel::selectionChanged(QItemSelection const&, QItemSelection const&) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x44
#16 0x7f4df000c6f8 in QItemSelectionModel::emitSelectionChanged(QItemSelection const&, QItemSelection const&) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x4e8
#17 0x7f4df000fd62 in QItemSelectionModel::select(QItemSelection const&, QFlags<QItemSelectionModel::SelectionFlag>) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x212
#18 0x7f4df000934b in QItemSelectionModel::setCurrentIndex(QModelIndex const&, QFlags<QItemSelectionModel::SelectionFlag>) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x19b
#19 0x7f4df0e56e1d in QAbstractItemView::setCurrentIndex(QModelIndex const&) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x9d
#20 0x7f4ce66c2ac7 in SketcherGui::TaskSketcherElements::slotElementsChanged() from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0x4b7
#21 0x7f4df2182b80 in boost::signals2::detail::signal_impl<void (), boost::signals2::optional_last_value<void>, int, std::less<int>, boost::function<void ()>, boost::function<void (boost::signals2::connection const&)>, boost::signals2::mutex>::operator()() from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x360
#22 0x7f4ce762981c in Sketcher::SketchObject::acceptGeometry() from /snap/freecad-realthunder/122/usr/lib/Sketcher.so+0x5c
#23 0x7f4ce76432eb in Sketcher::SketchObject::onChanged(App::Property const*) from /snap/freecad-realthunder/122/usr/lib/Sketcher.so+0xfab
#24 0x7f4df16abcc4 in App::Property::touch() from /snap/freecad-realthunder/122/usr/lib/libFreeCADApp.so+0x124
#25 0x7f4df16aa51c in App::Property::hasSetValue() from /snap/freecad-realthunder/122/usr/lib/libFreeCADApp.so+0x6c
#26 0x7f4de8f58b65 in Part::PropertyGeometryList::setValues(std::vector<Part::Geometry*, std::allocator<Part::Geometry*> >&&) from /snap/freecad-realthunder/122/usr/lib/Part.so+0x2d5
#27 0x7f4ce763be30 in Sketcher::SketchObject::solve(bool) from /snap/freecad-realthunder/122/usr/lib/Sketcher.so+0x560
#28 0x7f4ce764123d in Sketcher::SketchObject::delConstraints(std::vector<int, std::allocator<int> >, bool) from /snap/freecad-realthunder/122/usr/lib/Sketcher.so+0x40d
#29 0x7f4ce7641b92 in Sketcher::SketchObject::autoRemoveRedundants(bool) from /snap/freecad-realthunder/122/usr/lib/Sketcher.so+0x172
#30 0x7f4ce661acc6 in SketcherGui::tryAutoRecompute(Sketcher::SketchObject*, bool&) from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0xc6
#31 0x7f4ce661ad12 in SketcherGui::tryAutoRecompute(Sketcher::SketchObject*) from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0x22
#32 0x7f4ce6664735 in CmdSketcherConstrainSymmetric::activated(int) from /snap/freecad-realthunder/122/usr/lib/SketcherGui.so+0x835
#33 0x7f4df217ba48 in Gui::Command::_invoke(int, bool) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x258
#34 0x7f4df217bf15 in Gui::Command::invoke(int, Gui::Command::TriggerSource) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x155
#35 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(+0x2ec622) [0x7f4df008d622]
#36 0x7f4df0bdc996 in QAction::triggered(bool) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x46
#37 0x7f4df0bdf048 in QAction::activate(QAction::ActionEvent) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0xa8
#38 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x267d00) [0x7f4df0cdcd00]
#39 0x7f4df0cdcf25 in QAbstractButton::mouseReleaseEvent(QMouseEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0xe5
#40 0x7f4df0dd6c0e in QToolButton::mouseReleaseEvent(QMouseEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0xe
#41 0x7f4df0c25dc6 in QWidget::event(QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x286
#42 0x7f4df0dd6cb8 in QToolButton::event(QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x38
#43 0x7f4df0be2e53 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x83
#44 0x7f4df0bebe57 in QApplication::notify(QObject*, QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x397
#45 0x7f4df2109628 in Gui::GUIApplication::notify(QObject*, QEvent*) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x98
#46 0x7f4df00560aa in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x12a
#47 0x7f4df0beb157 in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool, bool) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1b7
#48 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x1cbfb4) [0x7f4df0c40fb4]
#49 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(+0x1cf2d4) [0x7f4df0c442d4]
#50 0x7f4df0be2e53 in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x83
#51 0x7f4df0bebc68 in QApplication::notify(QObject*, QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5+0x1a8
#52 0x7f4df2109628 in Gui::GUIApplication::notify(QObject*, QEvent*) from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x98
#53 0x7f4df00560aa in QCoreApplication::notifyInternal2(QObject*, QEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x12a
#54 0x7f4df047b7e0 in QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x660
#55 0x7f4df047ce85 in QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent*) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0x265
#56 0x7f4df04536dc in QWindowSystemInterface::sendWindowSystemEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Gui.so.5+0xac
#57 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/qt5/plugins/platforms/../../../libQt5XcbQpa.so.5(+0x79e5e) [0x7f4de48c7e5e]
#58 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x27d) [0x7f4ded0e317d]
#59 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x52400) [0x7f4ded0e3400]
#60 /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x33) [0x7f4ded0e34a3]
#61 0x7f4df00b0f82 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x62
#62 0x7f4df0054bab in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x12b
#63 0x7f4df005cd54 in QCoreApplication::exec() from /snap/freecad-realthunder/122/kf5/usr/lib/x86_64-linux-gnu/libQt5Core.so.5+0x94
#64 0x7f4df2047a24 in Gui::Application::runApplication() from /snap/freecad-realthunder/122/usr/lib/libFreeCADGui.so+0x404
#65 /snap/freecad-realthunder/122/usr/bin/FreeCADLink(+0xa380) [0x55ea54ed8380]
#66 /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7f4def1ac083]
#67 /snap/freecad-realthunder/122/usr/bin/FreeCADLink(+0xa79e) [0x55ea54ed879e]
I can confirm the crashes in sketcher with very simple operations in both the latest appimage and snap.
OS: Debian GNU/Linux 12 (bookworm) (KDE/plasma) Word size of FreeCAD: 64-bit Version: 2024.101.0.14555 (Git shallow) AppImage Build type: Release Branch: HEAD Hash: 97ccc0b4c01d671f5a85116ffa5f71464f1eee1c Python 3.11.6, Qt 5.15.8, Coin 4.0.1, Vtk 9.2.5, OCC 7.7.2 Locale: German/Austria (de_AT)
`[code] OS: Ubuntu Core 20 (KDE/plasma) Word size of FreeCAD: 64-bit Version: 2023.1231.0.38924 (Git) Snap 122 Build type: Release Branch: tag: 20231231tip Hash: 7471b6a2720ee4973b9477a55713070b056c42e8 Python 3.8.10, Qt 5.15.7, Coin 4.0.1, Vtk 7.1.1, OCC 7.6.3 Locale: German/Austria (de_AT) Installed mods:
here the terminal output in snap
Program received signal SIGSEGV, Segmentation fault.
I can confirm that the newest release is barely usable due to crashes in sketcher. I could use the previous one for hours without any serious incidents.
@realthunder Are those edit->timer.start(100)
introducing race conditions?
Why would that be? The crash happens because of de-syncrhonization of the sketch geometry and its visual representation. The timer is meant to delay visual update in (potentially recursive) UI event handling.
Why would that be? [...] The timer is meant to delay visual update [...]
It just looks like it, although I'm not familiar with the code. Anything that relies on timing (which is what "delay" presumably implies) could cause a race condition. What if the scheduler happens to not execute whatever other thread that is supposed to execute before the delayed thread? E.g., maybe there's a 150 ms scheduling interruption (say, because of page swapping), so that 100 ms delay is completely skipped. Does it then crash? If you want 2 threads to execute in a specific order then maybe have one of them wait for a signal from the other?
E.g., maybe there's a 150 ms scheduling interruption (say, because of page swapping), so that 100 ms delay is completely skipped. Does it then crash
This is indeed possible. But it is not a race condition
because there is only single thread execution. This is a state inconsistency problem which exists long time in Sketcher code. Upstream Sketcher has a huge refactor which I only ported part of it. Not sure if they have fundamentally solved it. A proper solution would be to guard any App
code access from Gui
side and check for update. There is just too many such kind of access without guard in the original code before the refactor.
Is there an existing issue for this?
Version
0.21 (Development)
Full version info
Subproject(s) affected?
Sketcher
Problem description
Frequent crashes for very common operations in sketcher (at least inside a Part Design body). E.g., creating some mirror constraint across a construction line or making some tangent constraints or even deleting some elements. E.g., deleting
Base.Sketch006.ExternalEdge2
in this: PowerRelayHolder.FCStd.zip Or selectEdge3
andEdge4
inBase.Sketch008
and select the tangent constraint in this: PowerRelayHolder2.FCStd.zipAnything else?
No response
Code of Conduct