Sketch causes segfault on one computer but not another

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!
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketch causes segfault on one computer but not another

Post by openBrain »

drmacro wrote: Sat Apr 10, 2021 3:26 pm Do you mean a trace that might be seen when running at the command line?

When it seg faults, that's basically all it says in the terminal. Segmentation fault (core dumped)
Precisely I mean the core dump (at least the part that shows the trace of the function calls in the stack).
In Kubuntu, the program called 'DrKonqi' generally allows the user to access the core dump, don't know for other distro.
You can also get useful information using Valgrind

Code: Select all

valgrind -v EXECUTABLE
Of course you'll have more info with a debug build, but still can get good things from a release one.
chrisb
Veteran
Posts: 54207
Joined: Tue Mar 17, 2015 9:14 am

Re: Sketch causes segfault on one computer but not another

Post by chrisb »

This is what I do in such cases:
- remove the constraints step by step until both sketches either behave identical or are identical in sketcher.
- If they are identical I open the file directly and compare both sketches in Document.xml.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
user1234
Veteran
Posts: 3511
Joined: Mon Jul 11, 2016 5:08 pm

Re: Sketch causes segfault on one computer but not another

Post by user1234 »

Hello!

Works here flawless:

Code: Select all

OS: Debian GNU/Linux bullseye/sid (X-Cinnamon/lightdm-xsession)
Word size of FreeCAD: 64-bit
Version: 0.20.24692 (Git)
Build type: Debug
Branch: master
Hash: 4e4068e44f4df06f352543c679da9079d1ffcb67
Python version: 3.9.2
Qt version: 5.15.2
Coin version: 4.0.0
OCC version: 7.5.1
Locale: English/United States (en_US)
and

Code: Select all

07:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Lexa XT [Radeon PRO WX 3100]
	Subsystem: Advanced Micro Devices, Inc. [AMD/ATI] Lexa XT [Radeon PRO WX 3100]
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu
Note: i use amdgpu not radeon. Check what you use (lspci -k). I had also issues with radeon, but not on FreeCAD.



Here the log from open the file:

Code: Select all

Log: 49.0008 MainWindow.cpp(1316): update actions
Log: Active view is Unnamed : 1[*] (at 0x7f57100088a0)
Log: Active document is Lower_test (at 0x55813420ae40)
Log: 71.9417 Tree.cpp(803): delay update status
Log: 71.9435 Tree.cpp(803): delay update status
Log: 71.9469 Tree.cpp(803): delay update status
Log: ViewProvider update time: 0.005000 s
Log: Shape tria info: Faces:0 Edges:8 Nodes:39 Triangles:0 IdxVec:39
Log: ViewProvider update time: 0.004000 s
Log: Shape tria info: Faces:0 Edges:8 Nodes:39 Triangles:0 IdxVec:39
Log: ViewProvider update time: 0.004000 s
Log: Shape tria info: Faces:0 Edges:8 Nodes:39 Triangles:0 IdxVec:39
Log: <Gui> ViewProviderDocumentObject.cpp(220): Lower_test#Sketch001.ViewObject.DiffuseColor changed
Log: <App> Application.cpp(776): Lower_test restore time: 0.0882454s
Log: <App> Application.cpp(777): Lower_test postprocess time: 0.00171449s
Log: <App> Application.cpp(779): total time: 0.090828s
Log: 72.098 Tree.cpp(2349): begin update status
Log: 72.0988 Tree.cpp(4418): [TreeView] Create item: 1, Lower_test#Sketch
Log: 72.0996 Tree.cpp(4418): [TreeView] Create item: 2, Lower_test#Sketch001
Log: 72.1002 Tree.cpp(4418): [TreeView] Create item: 3, Lower_test#Sketch002
Log: 72.1004 Tree.cpp(2410): update item status
Log: 72.1007 Tree.cpp(2504): done update status
Log: 72.1011 MainWindow.cpp(1316): update actions
Log: 72.2546 MainWindow.cpp(1316): update actions


Here the log from Sketch:

Code: Select all

Log: Active view is Lower-test : 1[*] (at 0x7f57100088a0)
Log: 101.554 MainWindow.cpp(1316): update actions
Log: 102.393 Selection.cpp(1108): Add Selection Lower_test#Sketch. (0, 0, 0)
Log: 102.553 MainWindow.cpp(1316): update actions
Log: <Gui> Document.cpp(331): deduced editing reference Lower_test#Sketch.
Log: 102.577 Selection.cpp(1609): Clear selection
Log: <Gui> ViewProviderDocumentObject.cpp(220): Lower_test#Sketch.ViewObject.TempoVis changed
Log: 102.85 Tree.cpp(803): delay update status
Log: Sketcher::setUpSketch()-T:0.018
Log: 102.998 Tree.cpp(803): delay update status
Log: Sketcher::Solve()-DogLeg-T:0.001
Log: 103.005 Tree.cpp(803): delay update status
Log: 103.012 Tree.cpp(803): delay update status
Log: 103.061 Tree.cpp(2349): begin update status
Log: 103.061 Tree.cpp(2410): update item status
Log: 103.062 Tree.cpp(2504): done update status
Log: 103.062 MainWindow.cpp(1316): update actions


Here the log from Sketch002:

Code: Select all

Log: Active view is Lower-test : 1[*] (at 0x7f57100088a0)
Log: 162.6 MainWindow.cpp(1316): update actions
Log: <3DViewer> View3DInventorViewer.cpp(883): add annotation 4 Sketch002.
Log: 164.873 Selection.cpp(1609): Clear selection
Log: 164.874 Selection.cpp(1108): Add Selection Lower_test#Sketch002. (0, 0, 0)
Log: 165.017 MainWindow.cpp(1316): update actions
Log: <Gui> Document.cpp(331): deduced editing reference Lower_test#Sketch002.
Log: 165.057 Selection.cpp(1609): Clear selection
Log: 165.08 Tree.cpp(803): delay update status
Log: Sketcher::setUpSketch()-T:0.012
Log: 165.147 Tree.cpp(803): delay update status
Log: Sketcher::Solve()-DogLeg-T:0
Log: 165.149 Tree.cpp(803): delay update status
Log: 165.154 Tree.cpp(803): delay update status
Log: 165.18 Tree.cpp(2349): begin update status
Log: 165.18 Tree.cpp(2410): update item status
Log: 165.181 Tree.cpp(2504): done update status
Log: 165.204 MainWindow.cpp(1316): update actions
Greetings
user1234
drmacro
Veteran
Posts: 8984
Joined: Sun Mar 02, 2014 4:35 pm

Re: Sketch causes segfault on one computer but not another

Post by drmacro »

chrisb wrote: Sat Apr 10, 2021 4:36 pm This is what I do in such cases:
- remove the constraints step by step until both sketches either behave identical or are identical in sketcher.
- If they are identical I open the file directly and compare both sketches in Document.xml.
But, the issue has narrowed down as I noted. It was not the removal of the constraint that actually fixed it, that was an outlier of my own doing when I changed the units.

Attempting to open the 'bad" sketch, on the hardware in question, with standard units set will cause the crash.
Doing the same with MKS units set and no crash.

So, how does the units setting have anything to do with graphics hardware/driver? 🤔
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketch causes segfault on one computer but not another

Post by openBrain »

Without any trace log, I'm afraid we'll never know. :)
drmacro
Veteran
Posts: 8984
Joined: Sun Mar 02, 2014 4:35 pm

Re: Sketch causes segfault on one computer but not another

Post by drmacro »

openBrain wrote: Sat Apr 10, 2021 5:56 pm Without any trace log, I'm afraid we'll never know. :)
Ok, ok, so tell, in terms your great grandmother would understand, step by step, how to get this wondrous log. :mrgreen:

My feeble attempts have failed so far. :(

This is the last lines of a few thousand from a run with valgrind:

Code: Select all

==17345== 2199 errors in context 233 of 233:
==17345== Invalid read of size 4
==17345==    at 0x63E27C1: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6401597: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6356954: PyAST_CompileObject (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x631CEAF: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x631D268: PyRun_StringFlags (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x636097F: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x63F03A6: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6205D6C: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x620746C: _PyEval_EvalFrameDefault (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x621106A: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6205D6C: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x620746C: _PyEval_EvalFrameDefault (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==  Address 0xd058020 is 432 bytes inside a block of size 768 free'd
==17345==    at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==17345==    by 0x6351200: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x63568CF: PyAST_CompileObject (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x631CEAF: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x631D268: PyRun_StringFlags (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x636097F: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x63F03A6: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6205D6C: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x620746C: _PyEval_EvalFrameDefault (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x621106A: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6205D6C: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x620746C: _PyEval_EvalFrameDefault (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==  Block was alloc'd at
==17345==    at 0x483B7F3: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==17345==    by 0x63EAFE2: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6347088: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634CD85: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634D1A2: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x6350586: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634D776: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634D1FC: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634D1FC: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634D1FC: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x634CF01: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345==    by 0x63539A8: ??? (in /usr/lib/x86_64-linux-gnu/libpython3.8.so.1.0)
==17345== 
==17345== ERROR SUMMARY: 15398 errors from 233 contexts (suppressed: 0 from 0)
Segmentation fault (core dumped)
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Sketch causes segfault on one computer but not another

Post by openBrain »

Maybe the '-v' in Valgrind is a bit too much. Could you try without it to see if something useful appears?
Also have a check in '/var/crash/' to see if you can locate the core dump. ;)
drmacro
Veteran
Posts: 8984
Joined: Sun Mar 02, 2014 4:35 pm

Re: Sketch causes segfault on one computer but not another

Post by drmacro »

openBrain wrote: Sat Apr 10, 2021 6:38 pm Maybe the '-v' in Valgrind is a bit too much. Could you try without it to see if something useful appears?
Also have a check in '/var/crash/' to see if you can locate the core dump. ;)
I've attached the output from valgrind sans -v.

The crash is 10's of MB...
Attachments
valgrind.txt
(500.28 KiB) Downloaded 12 times
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Syres
Veteran
Posts: 2900
Joined: Thu Aug 09, 2018 11:14 am

Re: Sketch causes segfault on one computer but not another

Post by Syres »

drmacro wrote: Sat Apr 10, 2021 5:27 pm Attempting to open the 'bad" sketch, on the hardware in question, with standard units set will cause the crash.
Doing the same with MKS units set and no crash.

So, how does the units setting have anything to do with graphics hardware/driver?
My educated guess is the graphics card isn't a factor but happy to be proved wrong. Looking at Bug 4124 thread https://forum.freecadweb.org/viewtopic.php?t=37716 , have you played around with any of the Advanced Solver Control settings particularly the Sketch Size Multiplier that @chrisb raises, it's unticked by default but always worth backing up the config files before playing with these and you'll need to set them using a new Sketch beforehand.
drmacro
Veteran
Posts: 8984
Joined: Sun Mar 02, 2014 4:35 pm

Re: Sketch causes segfault on one computer but not another

Post by drmacro »

Syres wrote: Sun Apr 11, 2021 11:01 am ...

My educated guess is the graphics card isn't a factor but happy to be proved wrong.
Yes, I agree. But, I've focused on that as a differentiating point between the two systems.
Looking at Bug 4124 thread https://forum.freecadweb.org/viewtopic.php?t=37716 , have you played around with any of the Advanced Solver Control settings particularly the Sketch Size Multiplier that @chrisb raises, it's unticked by default but always worth backing up the config files before playing with these and you'll need to set them using a new Sketch beforehand.
I tried ticking that, if anything FC then disappears quicker. (Probably just my perception. :mrgreen: ). But, no change. :roll:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Post Reply