[Bug] Chamfer bigger than 2mm crashes freecad

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
JvdB
Posts: 7
Joined: Sun Jan 21, 2018 10:34 am

[Bug] Chamfer bigger than 2mm crashes freecad

Postby JvdB » Sun Oct 21, 2018 11:42 pm

When I try to chamfer the upper lines of the lower block more than 2mm Freecad crashes.

I've attached both the drawing and the freecad errorlog.

Freecad reports a segentation fault.

Am I doing something wrong ?
Attachments
Been V1.fcstd
(18.88 KiB) Downloaded 15 times
Freecad Errorlog.txt
(5.43 KiB) Downloaded 15 times
chrisb
Posts: 18896
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby chrisb » Mon Oct 22, 2018 5:53 am

Although it can be partly derived from the log it is always good to add your FreeCAD info.
vocx
Posts: 1652
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby vocx » Mon Oct 22, 2018 6:01 am

JvdB wrote:
Sun Oct 21, 2018 11:42 pm
When I try to chamfer the upper lines of the lower block more than 2mm Freecad crashes.

I've attached both the drawing and the freecad errorlog.

Freecad reports a segentation fault.

Am I doing something wrong ?
I cannot reproduce the error.
FreeCad_chamfer.png
FreeCad_chamfer.png (63.5 KiB) Viewed 304 times
I'm using FreeCAD 0.18.

OS: Ubuntu 18.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14995 (Git)
Build type: Release
Branch: master
Hash: 7b866816785ac1ca9787b63d4bff12873bb3a593
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
chrisb
Posts: 18896
Joined: Tue Mar 17, 2015 9:14 am

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby chrisb » Mon Oct 22, 2018 6:02 am

It works here. But perhaps you should clarify which edges you exactly mean. When the radius is too big I get an error message, but no crash. Can you try with refining Pad002 before filleting, does it crash as well?

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14976 (Git)
Build type: Release
Branch: (HEAD detached at e79a19828)
Hash: e79a19828e2e92269ff96110dfeadaa245ad17c2
Python version: 2.7.15
Qt version: 5.11.2
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: German/Germany (de_DE)
JvdB
Posts: 7
Joined: Sun Jan 21, 2018 10:34 am

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby JvdB » Mon Oct 22, 2018 9:29 am

Ok,

I'm using:

OS: Linux Mint 18.3 Sylvia
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.14995 (Git)
Build type: Release
Branch: master
Hash: 7b866816785ac1ca9787b63d4bff12873bb3a593
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

I've added a second version of the sketch. When I change the size of the first chamfer to more than 2mm freecad crashes.
Attachments
Been V2.fcstd
(34.69 KiB) Downloaded 15 times
User avatar
bejant
Posts: 5934
Joined: Thu Jul 11, 2013 3:06 pm

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby bejant » Mon Oct 22, 2018 11:42 am

Changing the Chamfer to 3 mm so that it consumes the whole portion of the horizontal face crashes FreeCAD here too.
My daily build is from October 02:

OS: Ubuntu 18.04.1 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.18.14893 (Git)
Build type: Release
Branch: master
Hash: b8c50dc0f93410d1a8009a162385b50107c301ec
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)

Also crashes using 0.17:

OS: Ubuntu 18.04.1 LTS
Word size of OS: 32-bit
Word size of FreeCAD: 32-bit
Version: 0.17.13541 (Git)
Build type: None
Branch: releases/FreeCAD-0-17
Hash: 9948ee4f1570df9216862a79705afb367b2c6ffb
Python version: 2.7.15rc1
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
GeneFC
Posts: 1025
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby GeneFC » Mon Oct 22, 2018 2:54 pm

JvdB wrote:
Mon Oct 22, 2018 9:29 am
I've added a second version of the sketch. When I change the size of the first chamfer to more than 2mm freecad crashes.
This is a combination of several things.

* It is not reasonable to define the chamfer to go beyond 3 mm, because that is the maximum extent of the horizontal surface.

* This sort of operation often has problems when there is exact coincidence of edges, so setting the chamfer to exactly 3.0000 mm may or may not work. The OCC kernel is known to struggle with exact coincidences in some cases.

* Everything is floating point. It is possible that rounding errors in the 15th decimal place are causing problems.

The solution is to set the chamfer size to 2.99999 mm. I just tried and it works.

Gene
JvdB
Posts: 7
Joined: Sun Jan 21, 2018 10:34 am

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby JvdB » Mon Oct 22, 2018 4:01 pm

GeneFC wrote:
Mon Oct 22, 2018 2:54 pm
JvdB wrote:
Mon Oct 22, 2018 9:29 am
I've added a second version of the sketch. When I change the size of the first chamfer to more than 2mm freecad crashes.
This is a combination of several things.

* It is not reasonable to define the chamfer to go beyond 3 mm, because that is the maximum extent of the horizontal surface.

* This sort of operation often has problems when there is exact coincidence of edges, so setting the chamfer to exactly 3.0000 mm may or may not work. The OCC kernel is known to struggle with exact coincidences in some cases.

* Everything is floating point. It is possible that rounding errors in the 15th decimal place are causing problems.

The solution is to set the chamfer size to 2.99999 mm. I just tried and it works.

Gene
Great to hear there is a workaround :thumb: .
Then I have only one question left: Should I place a bugreport in the bug tracker or is it a known issue?
I think FreeCad should rather report an issue than crash but if it's a known problem, reporting is quite pointless :mrgreen:
GeneFC
Posts: 1025
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby GeneFC » Mon Oct 22, 2018 4:11 pm

The general limitation of coincident edges is very well known by developers at all levels. No point in trying to report it.

The crash issue is also well known, so again, no reason to report anew.

The crash does not occur on Windows because Windows is able to trap those errors with crashing. The underlying model still doesn't work; just no crash.

Gene
vocx
Posts: 1652
Joined: Thu Oct 18, 2018 9:18 pm

Re: [Bug] Chamfer bigger than 2mm crashes freecad

Postby vocx » Mon Oct 22, 2018 8:45 pm

JvdB wrote:
Mon Oct 22, 2018 9:29 am
Ok,

I've added a second version of the sketch. When I change the size of the first chamfer to more than 2mm freecad crashes.
You should have explained exactly which edges you were talking about. You can provide images, you know.

Anyway, I trapped the error using the debugger.

Code: Select all

gdb freecad-daily
Here is the log:

Code: Select all

Thread 1 "freecad-daily" received signal SIGSEGV, Segmentation fault.
0x00007fff63d660ba in BRep_Tool::Curve(TopoDS_Edge const&, TopLoc_Location&, double&, double&) () from /usr/lib/x86_64-linux-gnu/libTKBRep.so.7
(gdb) n
Single stepping until exit from function _ZN9BRep_Tool5CurveERK11TopoDS_EdgeR15TopLoc_LocationRdS5_,
which has no line number information.
0x00007ffff6ce8040 in segmentation_fault_handler(int) () from /usr/lib/freecad-daily/lib/libFreeCADApp.so
(gdb) n
Single stepping until exit from function _Z26segmentation_fault_handleri,
which has no line number information.
Program received signal SIGSEGV, Segmentation fault.
#0  /lib/x86_64-linux-gnu/libc.so.6(+0x3ef20) [0x7ffff4698f20]
#1  0x7fff63d660ba in BRep_Tool::Curve(TopoDS_Edge const&, TopLoc_Location&, double&, double&) from /usr/lib/x86_64-linux-gnu/libTKBRep.so.7+0x2a
#2  0x7fff63d69546 in BRep_Tool::Curve(TopoDS_Edge const&, double&, double&) from /usr/lib/x86_64-linux-gnu/libTKBRep.so.7+0x46
#3  0x7fff71f4fef5 in ChFi3d_Builder::PerformIntersectionAtEnd(int) from /usr/lib/x86_64-linux-gnu/libTKFillet.so.7+0x3b05
#4  0x7fff71f58307 in ChFi3d_Builder::PerformOneCorner(int, bool) from /usr/lib/x86_64-linux-gnu/libTKFillet.so.7+0x1097
#5  0x7fff71ef6218 in ChFi3d_Builder::PerformFilletOnVertex(int) from /usr/lib/x86_64-linux-gnu/libTKFillet.so.7+0x4e8
#6  0x7fff71ef71d1 in ChFi3d_Builder::Compute() from /usr/lib/x86_64-linux-gnu/libTKFillet.so.7+0xe31
#7  0x7fff720ad7c3 in BRepFilletAPI_MakeChamfer::Build() from /usr/lib/x86_64-linux-gnu/libTKFillet.so.7+0x33
#8  0x7fff723be48e in PartDesign::Chamfer::execute() from /usr/lib/freecad-daily/lib/_PartDesign.so+0x60e
#9  0x7ffff6c0d125 in App::DocumentObject::recompute() from /usr/lib/freecad-daily/lib/libFreeCADApp.so+0x295
#10  0x7fff61b620fb in Part::Feature::recompute() from /usr/lib/freecad-daily/lib/Part.so+0xb
#11  0x7ffff6bd2934 in App::Document::_recomputeFeature(App::DocumentObject*) from /usr/lib/freecad-daily/lib/libFreeCADApp.so+0xb4
#12  0x7ffff6bda2c3 in App::Document::recomputeFeature(App::DocumentObject*) from /usr/lib/freecad-daily/lib/libFreeCADApp.so+0x83
#13  0x7ffff518af70 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x4d0
#14  0x7ffff75f1193 in Gui::QuantitySpinBox::valueChanged(double) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x43
#15  0x7ffff75f1682 in Gui::QuantitySpinBox::userInput(QString const&) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x4d2
#16  0x7ffff518af70 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x4d0
#17  0x7ffff5ad4ef2 in QLineEdit::textChanged(QString const&) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x32
#18  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x5f7329) [0x7ffff5ad5329]
#19  0x7ffff518af70 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x4d0
#20  0x7ffff5d4b8e5 in QLineControl::textChanged(QString const&) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x35
#21  0x7ffff5ad94a8 in QLineControl::finishChange(int, bool, bool) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x1f8
#22  0x7ffff5ad99fb in QLineControl::internalSetText(QString const&, int, bool) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x1ab
#23  0x7ffff75f0378 in Gui::QuantitySpinBox::stepBy(int) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0xd8
#24  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x5a5f88) [0x7ffff5a83f88]
#25  0x7ffff5a841bf in QAbstractSpinBox::mousePressEvent(QMouseEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0xcf
#26  0x7ffff56fa4f0 in QWidget::event(QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0xe60
#27  0x7ffff75f59a6 in Gui::QuantitySpinBox::event(QEvent*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x36
#28  0x7ffff56a303c in QApplicationPrivate::notify_helper(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x8c
#29  0x7ffff56aa136 in QApplication::notify(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x476
#30  0x7ffff7314ae8 in Gui::GUIApplication::notify(QObject*, QEvent*) from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x88
#31  0x7ffff51768ad in QCoreApplication::notifyInternal(QObject*, QEvent*) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x8d
#32  0x7ffff56a973d in QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&, bool) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x14d
#33  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x249452) [0x7ffff5727452]
#34  0x7ffff5726ce3 in QApplication::x11ProcessEvent(_XEvent*) from /usr/lib/x86_64-linux-gnu/libQtGui.so.4+0x16b3
#35  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x272592) [0x7ffff5750592]
#36  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_dispatch+0x2e7) [0x7fffedd26287]
#37  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(+0x4c4c0) [0x7fffedd264c0]
#38  /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0(g_main_context_iteration+0x2c) [0x7fffedd2654c]
#39  0x7ffff51a720e in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x7e
#40  /usr/lib/x86_64-linux-gnu/libQtGui.so.4(+0x272666) [0x7ffff5750666]
#41  0x7ffff517512f in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x3f
#42  0x7ffff5175495 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x1b5
#43  0x7ffff517b459 in QCoreApplication::exec() from /usr/lib/x86_64-linux-gnu/libQtCore.so.4+0x99
#44  0x7ffff72be74e in Gui::Application::runApplication() from /usr/lib/freecad-daily/lib/libFreeCADGui.so+0x181e
#45  /usr/bin/freecad-daily(main+0x6db) [0x55555555741b]
#46  /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xe7) [0x7ffff467bb97]
#47  /usr/bin/freecad-daily(_start+0x2a) [0x5555555585ca]
So, yeah, it seems to choke on some drawing functions. I presume BRep_Tool::Curve() [from libTKBRep.so.7], ChFi3d_Builder::PerformIntersectionAtEnd() (from libTKFillet.so.7), and so on, are functions from OCC 7.0, the underlying geometry kernel.

So the problem is in OCC, but I don't think FreeCAD should immediately crash like that without displaying a message.