[invalid] [crash] when creating any view

Discussions about the development of the TechDraw workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

[invalid] [crash] when creating any view

Post by uwestoehr »

I just pulled from Git master, I have a clean local build branch and recompiled completely, but since today i get a crash when creating a new projction Group:

- here is an example file:
TD-distribute.FCStd
example file
(25.32 KiB) Downloaded 19 times
- select the torus and insert a projection group via the TechDraw menu

result:

Code: Select all

Illegal storage access...
<Exception> Illegal storage access! Please save your work under a new file name and restart the application!
0 <App> Document.cpp(3738): Failed to recompute TD_distribute#View: Illegal storage access! Please save your work under a new file name and restart the application!
It seems to be introduced toady. Abdullah, can you reproduce this as well? if so, could it be an issue with the latest undo changes?

abdullah wrote: .
OS: Windows 10 (10.0)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21623 (Git)
Build type: Release
Branch: master
Hash: 4a64679422fb8eaf4129b8d1fea7b46d025fd49e
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Last edited by uwestoehr on Mon Jun 15, 2020 9:54 pm, edited 2 times in total.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [crash] when creating any view

Post by uwestoehr »

uwestoehr wrote: Sun Jun 14, 2020 6:48 pm It seems to be introduced toady. Abdullah, can you reproduce this as well?
Bisect led me to this commit:

Code: Select all

git.exe bisect good
58e459cde1a60365510f308d94405ce58c9b008d is the first bad commit
commit 58e459cde1a60365510f308d94405ce58c9b008d
Author: Abdullah Tahiri <abdullah.tahiri.yo@gmail.com>
Date:   Thu Jun 11 20:09:02 2020 +0200

TaskDlgEditSketch: Remove unnecessary recompute

===============================================

On Undo/Redo there should not be an unconditional recompute.

The need for this recompute is probably related to the fact that PropertyConstraintList
has invalid geometry keys.

src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp | 22 +---------------------
src/Mod/Sketcher/Gui/TaskDlgEditSketch.h   |  4 +---
2 files changed, 2 insertions(+), 24 deletions(-)
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [crash] when creating any view

Post by wmayer »

I can't reproduce the crash and I don't see how TaskDlgEditSketch can be related to it.
When I do the steps as you say it's technically impossible that TaskDlgEditSketch can cause a crash because at this time the dialog was not used.
But even if I create a sketch, edit it, close the document and load then your project and add a projection group I still get no crash.

Can you make a debug build and test there again, please? This way you should get the call stack.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [crash] when creating any view

Post by uwestoehr »

wmayer wrote: Sun Jun 14, 2020 9:35 pm I can't reproduce the crash and I don't see how TaskDlgEditSketch can be related to it.
The situation is that I don't know what is actually going on. I am compiling for hours with bisect but everything leads to a crash. Moreover I don't get any useful output since it crashes immediately.

I run now a final bisect including my own changes that were merged today. I tested these PRs using the same documents with which I get now the crash, but one never knows. I'll report back as soon as I have a new result.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [crash] when creating any view

Post by uwestoehr »

I cleaned by build setup as best as possible and made a new bisect run and the result is this time:

Code: Select all

df4a8eb7ab6f107aab55ef5014ecb7fa49a22830 is the first bad commit
commit df4a8eb7ab6f107aab55ef5014ecb7fa49a22830
Author: Abdullah Tahiri <abdullah.tahiri.yo@gmail.com>
Date:   Sat Jun 13 07:24:43 2020 +0200

Document/DocumentObject: onUndoRedoFinished()

=============================================

New mechanism for on-demand signaling of undo/redo transaction finalisation.

The mechanism consists of:
1) A status bit that is set, when an object should receive this signaling (e.g. because changes during transaction have been inhibited)
2) The new function to be called by the Document undo/redo actions when the transaction is over (for those objects having the status bit set).

Note 1: The undo/redo signals are now outside the undoing FlagToggler, this means that:
1) a call to isPerformingTransaction will return false.
2) a recompute the slot of such a signal will not be inhibited.

Note 2: The undo/redo signals are called once the documentobjects that requested to be notified after the trasaction is over have been notified.
The consequence is that the viewprovider can rely on the documentobject having a correct status.

I think that the behaviour of Note and Note 2 is the wanted behaviour of this signals, I cannot rule out that other parts of FC rely on the old
implementation.

src/App/Document.cpp       | 22 +++++++++++++++++++++-
src/App/DocumentObject.cpp |  5 +++++
src/App/DocumentObject.h   |  3 +++
3 files changed, 29 insertions(+), 1 deletion(-)
To reproduce the crash please follow the way described in my initial commit.
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: [crash] when creating any view

Post by vocx »

Torus_projection.png
Torus_projection.png (45.77 KiB) Viewed 733 times
No crash.

Code: Select all

OS: Ubuntu 18.04.4 LTS (ubuntu:GNOME/ubuntu)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21623 (Git)
Build type: Release
Branch: master
Hash: 4a64679422fb8eaf4129b8d1fea7b46d025fd49e
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedStates (en_US)
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: [crash] when creating any view

Post by wmayer »

uwestoehr wrote: Sun Jun 14, 2020 10:14 pm I cleaned by build setup as best as possible and made a new bisect run and the result is this time:
It is absolutely impossible that this code change git commit df4a8eb7ab6 can cause the observed behaviour because the new code is simply not executed at this time.

The one and only explanation to me can be the addition of the new virtual method because this changes the memory layout of the class and thus makes the dll binary incompatible to its previous version. Therefore the affected code must be rebuilt. Sometimes MSVC is very bad in doing an incremental build correctly and you must completely erase any output of the build process and start a clean build.
User avatar
wandererfan
Veteran
Posts: 6317
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: [crash] when creating any view

Post by wandererfan »

uwestoehr wrote: Sun Jun 14, 2020 6:48 pm I just pulled from Git master, I have a clean local build branch and recompiled completely, but since today i get a crash when creating a new projction Group:
No crash here with:

OS: Linux Mint 19 (X-Cinnamon/cinnamon)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.21639 +5 (Git)
Build type: debug
Branch: sLineRotate2
Hash: 87430065d25f9505d50a750306ff312fe7989fb4
Python version: 3.6.9
Qt version: 5.9.5
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/Canada (en_CA)
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [crash] when creating any view

Post by uwestoehr »

wmayer wrote: Mon Jun 15, 2020 12:49 pm It is absolutely impossible that this code change git commit df4a8eb7ab6 can cause the observed behaviour because the new code is simply not executed at this time.
I am now at work and have here a MSVC compile environment (CMake, MSVC, LibPack etc. is the same). Here I get no crash. It seems that I have a preferences setting on my home PC that causes the crash. I'll have a look later this evening to find out why I get a crash one one PC but not on the other one.

Therefore the affected code must be rebuilt. Sometimes MSVC is very bad in doing an incremental build correctly and you must completely erase any output of the build process and start a clean build.
I did this already yesterday. I built FC from scratch twice.
User avatar
uwestoehr
Veteran
Posts: 4961
Joined: Sun Jan 27, 2019 3:21 am
Location: Germany
Contact:

Re: [crash] when creating any view

Post by uwestoehr »

Wow, this was a tricky one! It seemed is is a preferences issue. Thus I made screenshots of all settings from the PC without the crash and applied them here at home. But still I got a crash. Then I decided to delete my user preferences, still no success. So I updated master to latest git master, compiled, et voilá no crash anymore. :? :o

I have absolutely no clue what happened. It is also bad that I cannot reproduce the crash in order to fix the underlying issue. I cannot see what of today's commit might have fixed this for me.
I already recompiled FC for sure a dozen times yesterday.
But OK, bisect pointed me yesterday to 2 different commits -> something was fishy.

So the only explanation so far is that the deletion of the preferences had an influence. But it makes no sense when looking at the code.
Be it, I spent already too much time in this issue, so I'll leave it as it is since it is fine now.
Post Reply