FC crash when closing sketch

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
mlampert
Posts: 279
Joined: Fri Sep 16, 2016 9:28 pm

FC crash when closing sketch

Postby mlampert » Wed Feb 01, 2017 2:34 am

Almost every time I try to close the sketch in the attached file FC crashes. It happened the first time so I started over with a new file and created the sketch again, this time saving the file before closing the sketch - and FC crashed again.

The interesting part is that you can open and close the sketch as many times as you want without any ill effects - unless you make the body active. Once the body is active FC does not survive closing the sketch.

As a last oddity, if you make the Body active and try to extrude the sketch (without opening it first) it runs into an "Input error" with "Linked shape object is empty".

Hope somebody with stronger PartDesign kung-fu than mine can figure out what is or goes wrong.

OS: Debian GNU/Linux 9.0 (stretch)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9898 (Git)
Build type: Debug
Branch: master
Hash: 2d8461521964121b8ac7ac6ebe5f0d29dfe36343
Python version: 2.7.13
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Attachments
zero.fcstd
(5.73 KiB) Downloaded 17 times
User avatar
NormandC
Posts: 12022
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: FC crash when closing sketch

Postby NormandC » Wed Feb 01, 2017 4:21 am

No crash here. Providing a backtrace would be useful.

But your sketch isn't visible in the 3D view unless you edit it, which indicates some problem.

Forcing a recompute makes the sketch reappear, and may resolve your crash issue. Macro ForceRecompute

BTW symmetric constraints are a little unstable, it's best to limit their use. For your rectangle with rounded corners, you only need one single symmetric constraint between diagonally opposed points and the origin point.

OS: Ubuntu 14.04.5 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9927 (Git)
Build type: None
Branch: master
Hash: 2780edd903e9819eb0d0940ca0e754f1124ac188
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
mlampert
Posts: 279
Joined: Fri Sep 16, 2016 9:28 pm

Re: FC crash when closing sketch

Postby mlampert » Wed Feb 01, 2017 4:39 am

Even with recompute, once I made the body active FC crashes every time I close the sketch:

Code: Select all

#0  0x00007fffef5b8ac7 in QTextEngine::itemize() const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#1  0x00007fffef5baa6c in QTextEngine::attributes() const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#2  0x00007fffef5c708f in QTextLine::layout_helper(int) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#3  0x00007fffef666050 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#4  0x00007fffef666bb1 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#5  0x00007fffef66c37e in QCommonStyle::sizeFromContents(QStyle::ContentsType, QStyleOption const*, QSize const&, QWidget const*) const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#6  0x00007fffef719502 in QWindowsStyle::sizeFromContents(QStyle::ContentsType, QStyleOption const*, QSize const&, QWidget const*) const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#7  0x00007fffef70eb22 in QCleanlooksStyle::sizeFromContents(QStyle::ContentsType, QStyleOption const*, QSize const&, QWidget const*) const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#8  0x00007fffef6e88cc in QGtkStyle::sizeFromContents(QStyle::ContentsType, QStyleOption const*, QSize const&, QWidget const*) const () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#9  0x00007fffef6a6ee9 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#10 0x00007fffef931204 in QStyledItemDelegate::sizeHint(QStyleOptionViewItem const&, QModelIndex const&) const ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11 0x00007fffef8a8425 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#12 0x00007fffef8b425f in QListView::updateGeometries() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#13 0x00007fffef3a8e80 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#14 0x00007fffef76dc8e in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#15 0x00007fffef892ba3 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#16 0x00007fffee88c0a1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#17 0x00007fffef35252c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#18 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#19 0x00007ffff723e01f in Gui::GUIApplication::notify (this=0x7fffffffced0, receiver=0x5555583deac0,
    event=0x7fffff802c50) at /home/markus/projects/FreeCAD/github/mlampert/FreeCAD/src/Gui/GuiApplication.cpp:91
#20 0x00007fffee88bf1d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#21 0x00007fffef3f21be in QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#22 0x00007fffef3a1145 in QWidget::setGeometry(QRect const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#23 0x00007fffef7f1886 in QAbstractScrollAreaPrivate::layoutChildren() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#24 0x00007fffef7f2dc8 in QAbstractScrollArea::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#25 0x00007fffef89283b in QAbstractItemView::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#26 0x00007fffef35254c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#27 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#28 0x00007ffff723e01f in Gui::GUIApplication::notify (this=0x7fffffffced0, receiver=0x555557242590,
    event=0x7fffff803430) at /home/markus/projects/FreeCAD/github/mlampert/FreeCAD/src/Gui/GuiApplication.cpp:91
#29 0x00007fffee88bf1d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#30 0x00007fffef3a4d6a in QWidget::setContentsMargins(int, int, int, int) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#31 0x00007fffef7f1a40 in QAbstractScrollAreaPrivate::layoutChildren() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#32 0x00007fffef8b411c in QListView::updateGeometries() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#33 0x00007fffef3a8e80 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#34 0x00007fffef76dc8e in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#35 0x00007fffef892ba3 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#36 0x00007fffee88c0a1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#37 0x00007fffef35252c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#38 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
......
#11078 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11079 0x00007ffff723e01f in Gui::GUIApplication::notify (this=0x7fffffffced0, receiver=0x5555583deac0,
    event=0x7fffffa66180) at /home/markus/projects/FreeCAD/github/mlampert/FreeCAD/src/Gui/GuiApplication.cpp:91
#11080 0x00007fffee88bf1d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11081 0x00007fffef3f21be in QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11082 0x00007fffef3a1145 in QWidget::setGeometry(QRect const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11083 0x00007fffef7f1886 in QAbstractScrollAreaPrivate::layoutChildren() ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11084 0x00007fffef7f2dc8 in QAbstractScrollArea::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11085 0x00007fffef89283b in QAbstractItemView::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11086 0x00007fffef35254c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11087 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11088 0x00007ffff723e01f in Gui::GUIApplication::notify (this=0x7fffffffced0, receiver=0x555557242590,
    event=0x7fffffa66960) at /home/markus/projects/FreeCAD/github/mlampert/FreeCAD/src/Gui/GuiApplication.cpp:91
#11089 0x00007fffee88bf1d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11090 0x00007fffef3a4d6a in QWidget::setContentsMargins(int, int, int, int) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11091 0x00007fffef7f1a40 in QAbstractScrollAreaPrivate::layoutChildren() ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11092 0x00007fffef8b411c in QListView::updateGeometries() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11093 0x00007fffef3a8e80 in QWidget::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11094 0x00007fffef76dc8e in QFrame::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11095 0x00007fffef892ba3 in QAbstractItemView::viewportEvent(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11096 0x00007fffee88c0a1 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11097 0x00007fffef35252c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11098 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11099 0x00007ffff723e01f in Gui::GUIApplication::notify (this=0x7fffffffced0, receiver=0x5555583deac0,
    event=0x7fffffa67330) at /home/markus/projects/FreeCAD/github/mlampert/FreeCAD/src/Gui/GuiApplication.cpp:91
#11100 0x00007fffee88bf1d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11101 0x00007fffef3f21be in QWidgetPrivate::setGeometry_sys(int, int, int, int, bool) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11102 0x00007fffef3a1145 in QWidget::setGeometry(QRect const&) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11103 0x00007fffef7f1886 in QAbstractScrollAreaPrivate::layoutChildren() ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11104 0x00007fffef7f2dc8 in QAbstractScrollArea::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11105 0x00007fffef89283b in QAbstractItemView::event(QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11106 0x00007fffef35254c in QApplicationPrivate::notify_helper(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11107 0x00007fffef35952c in QApplication::notify(QObject*, QEvent*) () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11108 0x00007ffff723e01f in Gui::GUIApplication::notify (this=0x7fffffffced0, receiver=0x555557242590,
    event=0x7fffffa67b10) at /home/markus/projects/FreeCAD/github/mlampert/FreeCAD/src/Gui/GuiApplication.cpp:91
#11109 0x00007fffee88bf1d in QCoreApplication::notifyInternal(QObject*, QEvent*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#11110 0x00007fffef3a4d6a in QWidget::setContentsMargins(int, int, int, int) ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11111 0x00007fffef7f1a40 in QAbstractScrollAreaPrivate::layoutChildren() ()
   from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#11112 0x00007fffef8b411c in QListView::updateGeometries() () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
......

Eventually I got tired of hitting Enter.
wmayer
Site Admin
Posts: 11222
Joined: Thu Feb 19, 2009 10:32 am

Re: FC crash when closing sketch

Postby wmayer » Wed Feb 01, 2017 9:30 am

Almost every time I try to close the sketch in the attached file FC crashes. It happened the first time so I started over with a new file and created the sketch again, this time saving the file before closing the sketch - and FC crashed again.

The interesting part is that you can open and close the sketch as many times as you want without any ill effects - unless you make the body active. Once the body is active FC does not survive closing the sketch.

Obviously this is not related to the sketcher but a general problem when closing a task dialog. When e.g. when opening and closing the Placement panel does it also crash?

As a last oddity, if you make the Body active and try to extrude the sketch (without opening it first) it runs into an "Input error" with "Linked shape object is empty".

But it looks like that this is a separate issue and might be related to the "broken" sketch.

Even with recompute, once I made the body active FC crashes every time I close the sketch:

This callstack is ridiculously long. 11112 calls and more is just too long and I can imagine that you run into some kind of endless loop when the widget gets updated and FreeCAD crashes with a stack overflow.

In the past we had similar problems and in many cases the used theme (mainly oxygen on KDE) was the culprit. I wonder what happens when you change the desktop theme.
GeneFC
Posts: 61
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: FC crash when closing sketch

Postby GeneFC » Wed Feb 01, 2017 3:33 pm

I think Normand is correct. I removed all of the symmetric constraints and replaced them with fixed dimension constraints. The sketch then worked as expected.

Gene
mlampert
Posts: 279
Joined: Fri Sep 16, 2016 9:28 pm

Re: FC crash when closing sketch

Postby mlampert » Wed Feb 01, 2017 8:02 pm

It seems I didn't make the intent of this report very clear. Let me try again (bluntly).

The intent was not to figure out what is wrong with the sketch or how the sketch could be drawn differently so it doesn't crash FC (I appreciate the feedback though and will try and do better going forward). The sketch is not very complex, it has 12 elements and 29 constraints (of which only 5 are symmetries), it doesn't use datums, construction lines and/or external geometries. On top of that, it is fully constrained and the solver turns it green. As far as the user is concerned there can't possibly be anything wrong with this sketch.

And yet FC crashes - and it only does so when the body is active.

The intent was to help and make PartDesign more stable by providing a test case that seems to exercise something (IMHO) PD doesn't like.

@wmayer, tried the placement task panel and there is no problem with closing that, regardless of the Body's activity state.
DeepSOIC
Posts: 4422
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: FC crash when closing sketch

Postby DeepSOIC » Wed Feb 01, 2017 8:26 pm

I could not reproduce in:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9803 (Git)
Build type: Debug
Branch: (HEAD detached at FC/master)
Hash: dd63fe92107a87f6003f33518e387743a2090a1c
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0

Try disabling all add-on modules, just in case.
mlampert
Posts: 279
Joined: Fri Sep 16, 2016 9:28 pm

Re: FC crash when closing sketch

Postby mlampert » Wed Feb 01, 2017 9:09 pm

DeepSOIC wrote:Try disabling all add-on modules, just in case.

No add-on modules installed.

I got today's git version and did a clean build. After 'recompute' the sketch now indeed does show up and can be extruded after that. However, opening and closing the sketch when the body is active still results in the same segfault.
DeepSOIC
Posts: 4422
Joined: Fri Aug 29, 2014 12:45 am
Location: Saint-Petersburg, Russia

Re: FC crash when closing sketch

Postby DeepSOIC » Wed Feb 01, 2017 9:44 pm

Tried in newer version:
OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.9933 (Git)
Build type: Debug
Branch: (HEAD detached at FC/master)
Hash: 6c3b78e97bbb8653e1189038c99682becef71626
Python version: 2.7.8
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.0.0

Still no crash.
Judging by call stack, wmayer is likely right. If so, the need to activate body is likely some weird coincidence.

Can you reproduce it if you withdraw the sketch from the body?
App.ActiveDocument.Body.Group = []
mlampert
Posts: 279
Joined: Fri Sep 16, 2016 9:28 pm

Re: FC crash when closing sketch

Postby mlampert » Wed Feb 01, 2017 10:03 pm

DeepSOIC wrote:Can you reproduce it if you withdraw the sketch from the body?
App.ActiveDocument.Body.Group = []

Yes I can - but once again the Body (although detached) has to be active for the crash to happen. If the body isn't active then FC doesn't crash.