Reproducible FreeCAD crash (with bt and simple testcase)

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
arcol
Posts: 221
Joined: Sun Nov 10, 2013 9:02 am

Reproducible FreeCAD crash (with bt and simple testcase)

Postby arcol » Sat May 23, 2015 11:26 am

Hi,

This is my first bugreport, please be patient with me, and correct me if I did anything wrong.

I submitted the bug as #2116:
http://www.freecadweb.org/tracker/view.php?id=2116

The bug is basically when I click on a planeContraint06 in the treeview, FreeCAD segmentation faults.

Can somebody also reproduce it? What else should I report? Is it valid reporting a bug, which may come from an "extension" ?
(hamish' assembly workbench in this case)

My freecad info:

Code: Select all

OS: Ubuntu 14.10
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.4928 (Git)
Branch: master
Hash: d8f63bcfd10301f3d1e141cced4370f0782238d0
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Last edited by arcol on Sat May 23, 2015 12:21 pm, edited 2 times in total.
arcol
Posts: 221
Joined: Sun Nov 10, 2013 9:02 am

Re: Reproducible FreeCAD crash (with bt)

Postby arcol » Sat May 23, 2015 11:54 am

Ok, found a rather simple testcase.

Here is the two parts:
1. External part
external.png
external.png (18.38 KiB) Viewed 1310 times
external.fcstd
(6.43 KiB) Downloaded 15 times
2. Internal part
internal.png
internal.png (11.62 KiB) Viewed 1310 times
internal.fcstd
(5.12 KiB) Downloaded 15 times
3. The assembly:
assembly.png
assembly.png (19.07 KiB) Viewed 1310 times
(I hit the 5 attachment limit, so I'll continue in an another reply)
arcol
Posts: 221
Joined: Sun Nov 10, 2013 9:02 am

Re: Reproducible FreeCAD crash (with bt)

Postby arcol » Sat May 23, 2015 12:00 pm

So the original assembly file:
assembly.fcstd
(5.45 KiB) Downloaded 8 times
Now take the external part, delete the inner hole, and recreate a new one.
Screenshot, file:
external_new.png
external_new.png (17.85 KiB) Viewed 1307 times
external.fcstd
(6.38 KiB) Downloaded 13 times
Now open the original assembly file, and click any of the planeConstraint. Freecad will instantly crash.

So the actual bug is, the constraint defined between two faces.
When you modify the part, the faces are deleted, and new ones are created.

So the constraints becomes invalid. But instead recognizing such state, Assembly2 workbench tries to get the faces from FreeCAD.
Instead of FreeCAD recognizing there are no such faces, it tries to get it anyway, and the segmentation faul occurs.

Can anyone confirm? Maybe the workaround could be find in Assembly2 workbench, but I think FreeCAD should be also fixed to not crash.

Can somebody help me a little? aybe together we could even fix the bug, but I seriously need a helping hand here.

Thoughts? Reproducible to anyone else?
arcol
Posts: 221
Joined: Sun Nov 10, 2013 9:02 am

Re: Reproducible FreeCAD crash (with bt and simple testcase)

Postby arcol » Tue Jun 09, 2015 5:15 pm

I was hit by this very bug today. I came to the forum, to ask if anyone is hit by this error message, but I thought I'll
check my bug report, if it is not the same bug by chance.

Turns out, this is the exact same bug.

In the console, freecad prints:

Code: Select all

*** Abort *** an exception was raised, but no catch was found.
	...
	 The exception is:SIGSEGV 'segmentation violation' detected. Address 21
Running inside gdb:

Code: Select all

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/x86_64/strlen.S:106
106	../sysdeps/x86_64/strlen.S: No such file or directory.

How could I pressure somehow one of the developers to fix this annoying bug?:)
User avatar
quick61
Posts: 3793
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Reproducible FreeCAD crash (with bt and simple testcase)

Postby quick61 » Tue Jun 09, 2015 5:35 pm

This is not a problem with FreeCAD, but with a 3rd party plugin module. The assembly file won't even open in a standard FreeCAD version without the plugin. You should be reporting any bugs related to this module here - https://github.com/hamish2014/FreeCAD_assembly2/issues

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
arcol
Posts: 221
Joined: Sun Nov 10, 2013 9:02 am

Re: Reproducible FreeCAD crash (with bt and simple testcase)

Postby arcol » Tue Jun 09, 2015 6:51 pm

The normal FreeCAD crashes with a segmentation fault error.
Which is kind of serious and should be prevented even if a third party module is responsible to trigger the crash, no?
User avatar
quick61
Posts: 3793
Joined: Sat Aug 24, 2013 2:49 am
Location: u.S.A.

Re: Reproducible FreeCAD crash (with bt and simple testcase)

Postby quick61 » Tue Jun 09, 2015 7:08 pm

arcol wrote:The normal FreeCAD crashes with a segmentation fault error.
Which is kind of serious and should be prevented even if a third party module is responsible to *trigger* the crash. No?
No, I would be of the opinion that it is the sole responsibility of the 3rd party program. The FreeCAD developers can not be responsible for or be expected to compensate and protect against every 3rd party plugin that comes down the pike. Without the plugin FreeCAD is not crashing, so FreeCAD is fine. It's the plugin that is creating the condition for the crash, and it's the plugin that needs to be fixed, or those that have taken up development with the plugin providing a patch for FreeCAD that would allow the plugin to function correctly.

If this plugin was "official" or had been integrated into the official FreeCAD source code, then it would become the responsibility of the FreeCAD developers. But as of this date, the plugin does not adorn that status. ;)

Mark
This post made with 0.0% Micro$oft products - GOT LINUX?
wmayer
Site Admin
Posts: 15483
Joined: Thu Feb 19, 2009 10:32 am

Re: Reproducible FreeCAD crash (with bt and simple testcase)

Postby wmayer » Tue Jun 09, 2015 7:53 pm

The normal FreeCAD crashes with a segmentation fault error.
Which is kind of serious and should be prevented even if a third party module is responsible to trigger the crash, no?
The 3rd party module indeed triggers the crash but the erroneous code is in the core system of FreeCAD where an array is accessed on an invalid position.
arcol
Posts: 221
Joined: Sun Nov 10, 2013 9:02 am

Re: Reproducible FreeCAD crash (with bt and simple testcase)

Postby arcol » Tue Jun 09, 2015 9:07 pm

wmayer wrote:
The normal FreeCAD crashes with a segmentation fault error.
Which is kind of serious and should be prevented even if a third party module is responsible to trigger the crash, no?
The 3rd party module indeed triggers the crash but the erroneous code is in the core system of FreeCAD where an array is accessed on an invalid position.
Thank you wmayer for the fix. Where can I send the tip for the beer?

EDIT: It does not crash anymore, I can confirm on daily ubuntu freecad package.

EDIT2: I need to test it some more, but seems like the assembly2 wb works on updated parts!!1!OH!MY!GOD!!!

Onn the console it even displays:
Import: Updating Constraint SubElements Names
updating planeConstraint08.SubElement1 Face1->Face1
updating planeConstraint09.SubElement2 Face2->Face3
updating planeConstraint04.SubElement1 Face6->Face2
updating planeConstraint07.SubElement1 Face7->Face4

Can't believe. It is totally blackmagic. It blows my mind.
How is it done? Pure awesomeness!