Crash on editing sketch

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!
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Crash on editing sketch

Post by uwestoehr »

I have a reproducible crash:

- open the attached file:
Crashfile.FCStd
example file
(253.71 KiB) Downloaded 47 times
- open the Sketch "Sketch-Pinpad"
- set for the Edge 2 a vertical constraint (e.g. 3mm)
- close the sketch

result: crash
One out of 5 times it does not crash and I get an "access violation" in the report view.
Can anybody confirm this?

OS: Windows 10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17505 (Git)
Build type: Release
Branch: master
Hash: 755536e9df94d2d39da1468420f1fd333c35da7a
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
kisolre
Veteran
Posts: 4163
Joined: Wed Nov 21, 2018 1:13 pm

Re: Crash on editing sketch

Post by kisolre »

I made the dimension 5.4 at first and decreased it until it crashed. Looks like the crash occurs when the middle bottom opening is cleared. Then I started deleting fillets/chamfers and I had to delete all of them to fix the issue. So probably some edge gets remapped to something weird and that creates the crash. It should not crash but probably just give a warning.

OS: Windows 8.1 (6.3)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17651 (Git)
Build type: Release
Branch: master
Hash: 16c26cb3b1cd7209ea8efc8cb30b3b18fd80cf95
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: Bulgarian/Bulgaria (bg_BG)
chrisb
Veteran
Posts: 53930
Joined: Tue Mar 17, 2015 9:14 am

Re: Crash on editing sketch

Post by chrisb »

Confirmed on Mac too.

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17512 (Git)
Build type: Release
Branch: master
Hash: 7b315d3a15f6c0a3e796b2bf000cb791092de079
Python version: 3.7.3
Qt version: 5.9.7
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Germany (en_DE)
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Crash on editing sketch

Post by TheMarkster »

In Windows I only get an exception message (access violation) in the report view, no crash in 3 tries.

OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.17505 (Git)
Build type: Release
Branch: master
Hash: 755536e9df94d2d39da1468420f1fd333c35da7a
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/United States (en_US)

In Ubuntu debug build I get crash at line 100 of FeatureFillet.cpp.

The line is mkFillet->Build();

mkFillet is of type BRepFilletAPI_MakeFillet, which is an open cascade object.

It crashes even though the function is called inside a try except block. I tried using catch(...), which is a catch all for all exceptions in c++, but still the exception handler isn't called, only the crash happens. I'm not a c++ wizard by any means, but I don't see a way to avoid this type of crash simply by using try/catch blocks no matter even if a catchall type is used.

If found this information in the OCCT documentation:

virtual void BRepFilletAPI_MakeFillet::Build ( )
virtual
Builds the fillets on all the contours in the internal data structure of this algorithm and constructs the resulting shape. Use the function IsDone to verify that the filleted shape is built. Use the function Shape to retrieve the filleted shape. Warning The construction of fillets implements highly complex construction algorithms. Consequently, there may be instances where the algorithm fails, for example if the data defining the radius of the fillet is not compatible with the geometry of the initial shape. There is no initial analysis of errors and they only become evident at the construction stage. Additionally, in the current software release, the following cases are not handled:

the end point of the contour is the point of intersection of 4 or more edges of the shape, or
the intersection of the fillet with a face which limits the contour is not fully contained in this face.

Reimplemented from BRepBuilderAPI_MakeShape.
I don't know if either of the 2 documented cases that are not handled apply in this particular case, but my guess would be the 2nd one is the issue. But that is only a guess. One way FreeCAD could prevent this crash then would be to check to see if one of these cases are present before calling Build(), but this is beyond my meager skills.

I wonder if it would work to call OCCT library functions via a child process? If this could be done, then perhaps only the child process would crash and not FreeCAD? Likely, the idea has been already considered and dismissed at some point, but if it could work I can think of a number of benefits: 1) FreeCAD is much more stable against crashes; 2) Operations that are taking too long could be canceled by killing the child process; 3) There could be ways to use this for multi-threading, perhaps by spawning multiple instances of the child process, perhaps by allowing the user to continue using FreeCAD while the operation is pending.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: Crash on editing sketch

Post by uwestoehr »

Many thanks for having a look and the analysis.
I created now issue #4129.
friv
Posts: 48
Joined: Fri Jan 11, 2019 6:21 pm
Location: Россия

Re: Crash on editing sketch

Post by friv »

Hi All.

I have same problem.
When I edit a complex sketch, the program starts to crash regularly. And it crashes whenever you try to create a new line, size, or constraint. Sometimes any click on the sketch causes a drop.
Regards, Friv.

OS: Debian GNU/Linux 10 (buster)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.
Build type: Release
Python version: 3.7.2+
Qt version: 5.11.3
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Bance
Veteran
Posts: 4186
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Crash on editing sketch

Post by Bance »

friv wrote: Sun May 09, 2021 5:52 pm And it crashes whenever you try to create a new line, size, or constraint.
A crash is a sudden closure of the programme without warning, is this really your experience?
friv
Posts: 48
Joined: Fri Jan 11, 2019 6:21 pm
Location: Россия

Re: Crash on editing sketch

Post by friv »

Bance wrote: Sun May 09, 2021 6:25 pm
friv wrote: Sun May 09, 2021 5:52 pm And it crashes whenever you try to create a new line, size, or constraint.
A crash is a sudden closure of the programme without warning, is this really your experience?
The program closes without any warnings.
Bance
Veteran
Posts: 4186
Joined: Wed Feb 11, 2015 3:00 pm
Location: London

Re: Crash on editing sketch

Post by Bance »

Please upload an example file.

EDIT:- Upgrade your version is way out of date.
friv
Posts: 48
Joined: Fri Jan 11, 2019 6:21 pm
Location: Россия

Re: Crash on editing sketch

Post by friv »

Bance wrote: Sun May 09, 2021 6:43 pm Please upload an example file.

EDIT:- Upgrade your version is way out of date.
The program "breaks" with this file.
Attachments
Crash.FCStd
Program crash
(8.25 KiB) Downloaded 29 times
Post Reply