Ticket #6077 - Crash after changing pocket-size

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
cappu
Posts: 21
Joined: Wed Aug 22, 2018 2:08 pm
Location: Germany, near Moeckmuehl

Ticket #6077 - Crash after changing pocket-size

Post by cappu »

Hello,
My computer crashes after changing pocket size:
1) open RegalBuero (copy).FCStd https://www.magentacloud.de/lnk/ahAhDTWN
2) change WS to part-design
3) open last sketch043: RegalBuero/P2_KeinteilBoxen../B8_BodenHinten001/Seitenloecher/Sketch043

4) In this sketch043 change the very right-side hight-parameter from 32,8 to 33mm
5) close the sketch
6) look on cpu and RAM. On my PC CPU become 100% load (after aprox 5sec) and RAM starts slowly overflow (approx 30sec left until complete overflow)

I created bug-report : https://tracker.freecadweb.org/view.php?id=4378
issue #0004378
But I need to create a thread in form first. So, here it is. (hope it is the correct forum)
Does anyone's computer crashes at changing the pocket size too?
Thanks for info
Last edited by Kunda1 on Fri Apr 01, 2022 11:16 pm, edited 2 times in total.
Reason: Added GH ticket number to thread title
mikeprice99
Posts: 100
Joined: Sat Jun 27, 2020 9:06 am
Location: Dorset, England

Re: Computer crash after changing pocket size

Post by mikeprice99 »

I note from your bug tracker entry that you're running on Ubuntu.

I've (tested as per your instructions) on Windows 10 (rev 21775) and could not replicate the problem.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Computer crash after changing pocket size

Post by chrisb »

No problem here:

OS: macOS High Sierra (10.13)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21671 (Git)
Build type: Release
Branch: master
Hash: f05253f882b336f56aae32593faa5676fd5aafdd
Python version: 3.8.2
Qt version: 5.12.5
Coin version: 4.0.0
OCC version: 7.4.0
Locale: C/Default (C)

Sorry if you see me again very annoyed. We don't aks for a topic here before creating a bug report, we ask for a discussion! And we do so for good reasons: to minimize the work for the developers. Here in the forum we have quite some knowledge to identify bugs, make proposals and so on.
Your version is not quite up-to-date, can you retry with the latest?

Of course FreeCAD should not crash, but meanwhile you should get your model right: Changing the constraint as described above shows many "Constraint xx is malformed" messages. Since you don't know from which sketch they come, you have to identify it. This can be rather tedious, e.g. by deleting some sketches at the end of the tre and see if the message still occurs.
Furthermore you may consider to pocket the oval only once and then apply a linear pattern.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Computer crash after changing pocket size

Post by chrisb »

Memory usage goes up to more than 3.5G here. So you may simply have run out of memory?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
freecad-heini-1
Veteran
Posts: 7788
Joined: Tue Jan 07, 2014 11:10 am
Contact:

Re: Computer crash after changing pocket size

Post by freecad-heini-1 »

No problem here, on my old Packard-Bell Notebook Easynote LE69KB with Xubuntu 18.04 and Freecad 0.19:

Code: Select all

OS: Ubuntu 18.04.4 LTS (XFCE/xubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.
Build type: Release
Branch: unknown
Hash: 79e11ce8a1c382d92af39d58dbd7e7ccc8c0fefa
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
wmayer
Founder
Posts: 20202
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Computer crash after changing pocket size

Post by wmayer »

I often have seen this kind of problem with OCC. The kernel from time to time tries to allocate a huge amount of memory -- sometimes it's legit I think but sometimes there is an integer overflow where an array of a size of several billion elements is created.

For the old 32-bit applications this was less of a problem because a process couldn't allocate more than 2 GB (with some special linking option it could be increased to 3 GB on Windows XP) and if the requested memory is too much a new handler is triggered. In FreeCAD we have implemented it to raise a memory exception.

Maybe it's an option to overwrite the global new operator https://en.cppreference.com/w/cpp/memor ... erator_new and raise an exception if a block seems ridiculously high.

Other options might be to set some hard limits for a process. Here are some references I found for Windows and Linux
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Computer crash after changing pocket size

Post by chrisb »

There is an issue occurring in the model linked to the first post, which is not directly linked to OP's problem: On recompute of the last Sketch043 a message occurs "Sketcher constraint number 23 is malformed!". As mentioned above this occurs if changes are made in previous steps.
Is it worth a feature request to augment this message with the name or label of the sketch? It can be very difficult in bigger models to find the sketch containing the error.
Abdullah wrote:ping
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Computer crash after changing pocket size

Post by abdullah »

chrisb wrote: Sun Jun 28, 2020 3:55 pm There is an issue occurring in the model linked to the first post, which is not directly linked to OP's problem: On recompute of the last Sketch043 a message occurs "Sketcher constraint number 23 is malformed!". As mentioned above this occurs if changes are made in previous steps.
Is it worth a feature request to augment this message with the name or label of the sketch? It can be very difficult in bigger models to find the sketch containing the error.
Abdullah wrote:ping
Sorry to come to this one so late.

That error message comes directly from the solver interface. It was not intended as an exception, so that the solve could continue (though I have serious doubt this is a sound decision, as malformed constraints are like a drunk driver going top speed in the motorway in the incorrect sense).

As the solver does not know about sketches, I have coded an additional error message to complement those errors (see last line):

Code: Select all

Sketcher constraint number 23 is malformed!
Sketcher constraint number 24 is malformed!
Sketcher constraint number 28 is malformed!
Sketcher constraint number 46 is malformed!
Sketcher constraint number 56 is malformed!
Sketcher constraint number 80 is malformed!
EigenSparseQR, Threads: 1, Vectorization: On, Pivot Threshold: 1e-13, Params: 280, Constr: 280, Rank: 280
Sketcher::setUpSketch()-T:0.193
DL: tolg: 1e-80, tolx: 1e-80, tolf: 1e-10, convergence: 1e-10, dogLegGaussStep: FullPivLU, xsize: 189, csize: 189, maxIter: 100
DL: stopcode: 1, Success
Sketcher::Solve()-DogLeg-T:0.009
Sketch Sketch043 has malformed constraints!
I will be committing this soon.

All those constraints are tangency constraints. What is much more relevant for me is: How can one create tangencies to itself?
Screenshot_20200702_173653.png
Screenshot_20200702_173653.png (35.54 KiB) Viewed 4690 times
There are even several tangencies [(0,0), (0,0)].

I would really like to fix the bug that makes that possible, so if you manage to reproduce that, let me know.
chrisb
Veteran
Posts: 53785
Joined: Tue Mar 17, 2015 9:14 am

Re: Computer crash after changing pocket size

Post by chrisb »

abdullah wrote: Thu Jul 02, 2020 3:39 pm I would really like to fix the bug that makes that possible, so if you manage to reproduce that, let me know.
I have no idea how this could have happened. But I have seen the message recently (perhaps I even reported it repeatedly) after making changes to previous steps and thus changing external geometry references.
It quite sure does not occur while working on the sketch itslef, that's why it stays rather long unattended, and when it is detected it is too late to reproduce. I am tended to say the incubation time is rather long.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Computer crash after changing pocket size

Post by abdullah »

chrisb wrote: Sun Jun 28, 2020 3:55 pm Is it worth a feature request to augment this message with the name or label of the sketch?
git commit 31b1ad874fb4750b6f6f25b494246f6ac7e61cde
Post Reply