View Issue Details

IDProjectCategoryView StatusLast Update
0024007CommunityOCCT:Data Exchangepublic2013-12-19 13:58
ReporterRoman Lygin Assigned ToRoman Lygin  
PrioritynormalSeveritymajor 
Status closedResolutionfixed 
PlatformAOSL 
Product Version6.6.0 
Target Version6.7.0Fixed in Version6.7.0 
Summary0024007: [Regression] Sporadic crashes when working with XDE documents
DescriptionThe fix 0023523 has changed the order of destroying the document contents: destructors of the attributes are now called with null Label().
This invalidates the fix 0023593 and resurrects the problem.

The current fix removes a global map and thus eliminates a risk of orphan labels.
Steps To ReproduceApparently the problem is not captured by OCC automatic tests due to different memory allocator - as the problem shows up when there is a clash of the addresses - when a root label gets the same address as already destroyed one.

No new test case is required.
TagsNo tags attached.
Test case numberNot needed

Attached Files

  • crash_DocumentClosing.png (15,936 bytes)

Relationships

related to 0023523 closedgka Open CASCADE In session DRAW it is impossible to close document having name already once closed document. 
related to 0023593 closedRoman Lygin Community XCAFDoc_DocumentTool label must be removed from internal map upon closing the XDE document 
related to 0024047 closedgka Open CASCADE Exception in TPrsStd_AISPresentation during destruction of TDocStd_Document 
related to 0024164 closedbugmaster Open CASCADE Optimization of OCAF document closing 

Activities

Roman Lygin

2013-06-02 11:46

developer   ~0024590

The fix has been pushed to the git repository.

Roman Lygin

2013-06-02 12:05

developer   ~0024591

See more details in http://opencascade.blogspot.com/2013/06/significant-side-effects-in-ocafxde-660.html

Pawel

2013-06-02 15:10

developer   ~0024593

Hello Roman,

as stated in 0023554 since then I've dealt with some occasional crashes upon XDE document destruction I was not able to identify. Mostly freeing labels with XCAFDoc_ColorTool caused the problem but neither was I able to reproduce nor to isolate it.

I'll test your fix tomorrow and hope I can give positive feedback.

Thank you!

Roman Lygin

2013-06-02 15:58

developer   ~0024594

Thanks Pawel. Yes, please confirm if this helps your case.
FYI - OCC tests "testgrid xcaf" do pass. So do proprietary CAD Exchanger's.

Pawel

2013-06-03 13:22

developer   ~0024602

Hello Roman,

I have applied this fix and followed your advice to store the handle to the AIS_InteractiveContext outside the document. It seems to help in most cases...

However, I still have one XDE file (unfortunately cutomer data) that does crash upon closing the document. As described above, the problem is XCAFDoc_ColorTool attribute.

Do you think there might be a similar issue with XCAFDoc_*Tool attributes as the one corrected by you?

Roman Lygin

2013-06-03 13:28

developer   ~0024603

Hi Pawel,
can you post a stack trace ?

Pawel

2013-06-03 14:16

developer  

crash_DocumentClosing.png (15,936 bytes)

Pawel

2013-06-03 14:21

developer   ~0024604

Hi Roman,

I attached a picture to clarify.

The crash occurs when 'forgetting' a XCAFDoc_ColorTool sub-label (0x000000000a00b818). Precisely, when forgetting TDataStd_TreeNode attribute.

TDF_Label::ForgetFromNode crashes in line 601:

    if (fromNode->Data()->NotUndoMode()) {

Below stack trace.

If you have any questions please let me know.

Unfortunately, lots of internal OCCT mechanisms are beyond my understanding so I'm very happy about any help on the issue. Thanks!

TKLCAF.dll!TDF_Label::ForgetFromNode(TDF_LabelNode * const & fromNode=0x000000000a00b818, const Handle_TDF_Attribute & anAttribute={...}) Line 601
TKLCAF.dll!TDF_Label::ForgetAllAttributes(const unsigned int clearChildren=1) Line 500 + 0x1a Bytes
TKLCAF.dll!TDF_Label::ForgetAllAttributes(const unsigned int clearChildren=1) Line 508 + 0x1b Bytes
TKLCAF.dll!TDF_Label::ForgetAllAttributes(const unsigned int clearChildren=1) Line 508 + 0x1b Bytes
TKLCAF.dll!TDF_Label::ForgetAllAttributes(const unsigned int clearChildren=1) Line 508 + 0x1b Bytes
TKLCAF.dll!TDocStd_Document::Destroy() Line 81
TKLCAF.dll!TDocStd_Document::~TDocStd_Document() Line 224 + 0xa Bytes
TKLCAF.dll!TDocStd_Document::`scalar deleting destructor'() + 0x17 Bytes
TKernel.dll!Standard_Transient::Delete() Line 82 + 0x30 Bytes
TKernel.dll!Handle_Standard_Transient::EndScope() Line 58

Roman Lygin

2013-06-03 14:45

developer   ~0024607

Last edited: 2013-06-03 14:46

Thanks. Is this XCAFDoc_Color or _ColorTool ? The latter does not have a TreeNode attached to the same label, while the former - does.

Anyway, I briefly looked at the TDataStd_TreeNode::BeforeForget() and TDataStd_TreeNode::Remove(). They seem to be safe enough, and given that the trees can be directed in any direction, the changed behavior should not cause a side-effect (in theory).
There is however IsBackuped() check in ::BeforeForget() and perhaps another control flow causes different behavior.
I guess the only feasible way would be to have a C++ reproducer. DRAW seems to be too non-representative - there are multiple global objects (variables, AIS_IC, application, ...) holding handles to objects

Pawel

2013-06-03 15:01

developer   ~0024611

Sorry for lacking precision ;)

I meant the TDF_Label (0x000000000a00b818) containing the XCAFDoc_Color attribute.

Unfortunately, I was not able to create a reproducer...

Pawel

2013-06-05 17:54

developer   ~0024641

For the record: the problem with crash when deleting labels with XCAFDoc_Color attribute resulted from "damaged" XDE structure (cyclic dependency of TDataStd_TreeNode) and has nothing to do with the issue reported/corrected by Roman here.

gka

2013-07-01 12:13

developer   ~0024925

Branch CR24007 is ready to be tested.

mkv

2013-07-03 11:43

tester   ~0024952

Dear BugMaster,

Branch CR24007 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
SHA-1: aa66e3b27d03a38213974173f43b18e46d032af5

Number of compiler warnings:

occt component :
Linux: 2 (2 on master)
Windows: 7 (7 on master)

products component :
Linux: 0 (0 on master)
Windows: 63 (63 on master)

Regressions:
No regressions

Improvements:
No improvements

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 366342436 / 366203376
Total CPU difference: 44579.97000000128 / 43388.71000000102

Testing on Windows:
Total MEMORY difference: 422133272 / 424066896
Total CPU difference: 32228.75 / 44233.921875

There are not differences in images found by testdiff.

Related Changesets

occt: master 388fc344

2013-07-04 10:33:30

Roman Lygin

Details Diff
0024007: [Regression] Sporadic crashes when working with XDE documents Affected Issues
0024007
mod - src/XCAFDoc/GUID.txt Diff File
mod - src/XCAFDoc/XCAFDoc_DocumentTool.cxx Diff File

Issue History

Date Modified Username Field Change
2013-06-02 11:41 Roman Lygin New Issue
2013-06-02 11:41 Roman Lygin Assigned To => gka
2013-06-02 11:46 Roman Lygin Note Added: 0024590
2013-06-02 11:46 Roman Lygin Status new => resolved
2013-06-02 12:05 Roman Lygin Note Added: 0024591
2013-06-02 12:18 Roman Lygin Relationship added related to 0023523
2013-06-02 12:18 Roman Lygin Relationship added related to 0023593
2013-06-02 15:10 Pawel Note Added: 0024593
2013-06-02 15:58 Roman Lygin Note Added: 0024594
2013-06-03 13:22 Pawel Note Added: 0024602
2013-06-03 13:28 Roman Lygin Note Added: 0024603
2013-06-03 14:16 Pawel File Added: crash_DocumentClosing.png
2013-06-03 14:21 Pawel Note Added: 0024604
2013-06-03 14:45 Roman Lygin Note Added: 0024607
2013-06-03 14:46 Roman Lygin Note Edited: 0024607
2013-06-03 15:01 Pawel Note Added: 0024611
2013-06-05 17:54 Pawel Note Added: 0024641
2013-06-26 12:19 gka Relationship added related to 0024047
2013-07-01 12:13 gka Note Added: 0024925
2013-07-01 12:13 gka Status resolved => reviewed
2013-07-01 13:12 mkv Assigned To gka => mkv
2013-07-03 11:43 mkv Note Added: 0024952
2013-07-03 11:43 mkv Test case number => Not needed
2013-07-03 11:43 mkv Assigned To mkv => bugmaster
2013-07-03 11:43 mkv Status reviewed => tested
2013-07-03 11:44 apn Target Version => 6.7.0
2013-07-05 11:57 Roman Lygin Changeset attached => occt master 388fc344
2013-07-05 11:57 Roman Lygin Assigned To bugmaster => Roman Lygin
2013-07-05 11:57 Roman Lygin Status tested => verified
2013-07-05 11:57 Roman Lygin Resolution open => fixed
2013-10-02 15:52 abv Relationship added related to 0024164
2013-12-19 13:52 bugmaster Status verified => closed
2013-12-19 13:58 bugmaster Fixed in Version => 6.7.0