Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
User avatar
Kunda1
Posts: 4773
Joined: Thu Jan 05, 2017 9:03 pm

Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby Kunda1 » Tue Jan 17, 2017 1:18 am

issue #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL
Description
I imported a STEP file into FreeCAD, then attempted to export it as WebGL. FreeCAD crashed (segmentation fault). The error message displayed in the terminal is below the version information, and the log and relevant STEP file are attached.

OS: Linux Mint 17.2 Rafaela
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.7731 (Git)
Build type: None
Branch: master
Hash: dea884ab6a4a748cd61cb593ee91f0eef1bdb603
Python version: 2.7.6
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17


FreeCAD 0.17, Libs: 0.17R7731 (Git)
© Juergen Riegel, Werner Mayer, Yorik van Havre 2001-2015
##### #### ### ####
# # # # # #
# ## #### #### # # # # #
#### # # # # # # # ##### # #
# # #### #### # # # # #
# # # # # # # # # ## ## ##
# # #### #### ### # # #### ## ## ##

Fasteners workbench Loaded
Segmentation fault
Steps To Reproduce
1. Open attached STEP file in FreeCAD.
2. Attempt to export it as WebGL.

Additional Information
The STEP file was created using FreeCAD (stable release version, I believe, but I may be wrong). I created another STEP file with only a simple cube primitive, and it does not cause this issue.
yorik wrote:Will have a look, but this file is huge... Probably what fails is the meshing, the internal mesher is known to have problems with huge objects
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 4773
Joined: Thu Jan 05, 2017 9:03 pm

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby Kunda1 » Fri May 26, 2017 4:30 pm

Any testers available to reproduce this issue?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
fosselius
Posts: 340
Joined: Sat Apr 23, 2016 10:03 am

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby fosselius » Fri May 26, 2017 6:40 pm

Oh, we can export to WebGL? awesome! will try to build latest from git and try.

UPDATE:

Tested on my current build and it crashes, it works if you export to stl, import and then export to WebGL.
I have posted the resulting html file in the issue/ticket above. This is a build from last week, but i guess nothing have changed? will test again when today's build is done.
User avatar
Kunda1
Posts: 4773
Joined: Thu Jan 05, 2017 9:03 pm

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby Kunda1 » Fri May 26, 2017 7:07 pm

fosselius wrote:
Fri May 26, 2017 6:40 pm
Oh, we can export to WebGL? awesome! will try to build latest from git and try.

UPDATE:

Tested on my current build and it crashes, it works if you export to stl, import and then export to WebGL.
I have posted the resulting html file in the issue/ticket above. This is a build from last week, but i guess nothing have changed? will test again when today's build is done.
Thanks! Can you post trace of crash?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
fosselius
Posts: 340
Joined: Sat Apr 23, 2016 10:03 am

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby fosselius » Fri May 26, 2017 7:17 pm

Thread 1 "FreeCAD" received signal SIGSEGV, Segmentation fault.
0x00007fffb09ae80c in BRepAdaptor_CompCurve::Prepare(double&, double&, int&) const ()
from /usr/lib/x86_64-linux-gnu/libTKBRep.so.10


So this makes sense that the STL export works and the STEP doesent, STL wont trigger CompCurve as it does not contain a "real" curve?
User avatar
Kunda1
Posts: 4773
Joined: Thu Jan 05, 2017 9:03 pm

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby Kunda1 » Tue Jul 11, 2017 10:57 am

wmayer wrote:ping
Do you mind weighing in on this ticket? Thanks!
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 4773
Joined: Thu Jan 05, 2017 9:03 pm

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby Kunda1 » Mon Dec 11, 2017 7:53 pm

Per @wmayer in https://freecadweb.org/tracker/view.php?id=2590#c9972
wmayer wrote: It's not the mesher where the crash happens because otherwise it would already fail when loading the file.
It appears that the crash occurs in the function discretize which is called in the importWebGL.py script inside the function getObjectData.
With this code snippet one can reliably reproduce the crash:

Code: Select all

obj=App.ActiveDocument.Part__Feature
wires=[]
for f in obj.Shape.Faces:
  for w in f.Wires:
    wo = Part.Wire(Part.__sortEdges__(w.Edges))
    wires.append(wo)


wires[1].discretize(QuasiDeflection=0.1)
wires[19].discretize(QuasiDeflection=0.1)

wmayer wrote: It shows that the crash happens for the second and last wire in the list.

Running the Python code in the debugger reveals that the crash happens in OCC in the function QuasiFleche due to a stack overflow.
We need someone to open a ticket in the upstream OCCT tracker to track this issue. I know @ickby has mentioned being a sort of liason with the OCC folks. Too bad shoogen isn't around anymore, he filed a bunch of upstream bugs with them.
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
amunizp
Posts: 5
Joined: Wed Sep 20, 2017 9:27 am

Re: Bug #2590: FreeCAD (0.17 Daily) crashes on exporting imported STEP as WebGL

Postby amunizp » Tue Jul 10, 2018 1:59 pm

I just updated the bug on the issue tracker for FreeCAD. Don't know how to report it elsewhere yet.

I have searched a bit on OCCT forum, is this related:
https://www.opencascade.com/content/rea ... step-files