MantisBT - Community
View Issue Details
0027432Community[OCCT] OCCT:Foundation Classespublic2016-04-26 10:552016-12-09 16:37
BenjaminBihler 
bugmaster 
normalcrash 
closedfixed 
WindowsVC++ 201564 bit
[OCCT] 7.0.0 
[OCCT] 7.1.0[OCCT] 7.1.0 
Not needed
0027432: Null Handle Access When Creating AIS_Trihedron
When I create an AIS_Trihedron with the following code

Handle(Geom_Axis2Placement) placement = new Geom_Axis2Placement(
            robotPathPoint->getAxisSystem());

interactiveObject = new AIS_Trihedron(placement);

my application crashes, but only when OCCT is compiled in release mode. If OCCT is compiled in debug mode, no crash happens.

By entering debug text output into the related OCCT files, I have been able to find out that lstlexicon is a null-handle in line 74 of Units_Sentence.cxx and that is the reason for the crash.

The line reads:

    for(index=1; index<=lstlexicon->Length(); index++) {

Actually line 63 reads:

  Units_NoSuchType_Raise_if(lstlexicon.IsNull(),"BAD LEXICON descriptor");

and throwing an exception here would prevent working with a null lstlexicon, but in release builds the macro "No_Exception" seems to be defined here, which prevents the exception. But then I get a crash.
In a new DRAW session:

set env(CSF_UnitsDefinition) /dev/null
set env(CSF_UnitsLexicon) /dev/null
pload VISUALIZATION
vinit
vtrihedron t

Note that exception does not reproduce in DRAW in Release mode, but can be caught in debugger in Debug mode
No tags attached.
related to 0027258closed apn Open CASCADE Configuration - generate built-in replacement for mandatory resource files 
Issue History
2016-04-26 10:55BenjaminBihlerNew Issue
2016-04-26 10:55BenjaminBihlerAssigned To => kgv
2016-04-26 10:57BenjaminBihlerNote Added: 0053574
2016-04-26 16:57BenjaminBihlerProduct Version => 7.0.0
2016-04-26 19:51kgvRelationship addedrelated to 0027258
2016-04-26 19:54kgvNote Added: 0053619
2016-04-26 19:54kgvAssigned Tokgv => BenjaminBihler
2016-04-26 19:54kgvStatusnew => feedback
2016-04-26 21:25gitNote Added: 0053621
2016-04-26 21:25abvNote Added: 0053622
2016-04-27 06:52abvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=13576#r13576
2016-04-27 10:26kgvCategoryOCCT:Visualization => OCCT:Foundation Classes
2016-04-28 11:19BenjaminBihlerNote Added: 0053661
2016-04-29 09:41BenjaminBihlerAssigned ToBenjaminBihler => abv
2016-04-29 09:42BenjaminBihlerStatusfeedback => resolved
2016-05-05 15:47gitNote Added: 0053850
2016-05-09 12:49abvNote Added: 0053917
2016-05-09 12:49abvAssigned Toabv => bugmaster
2016-05-09 12:49abvStatusresolved => reviewed
2016-05-10 12:39gitNote Added: 0053943
2016-05-10 12:44mkvAssigned Tobugmaster => mkv
2016-05-11 16:00mkvNote Added: 0053993
2016-05-11 16:00mkvNote Added: 0053994
2016-05-11 16:00gitNote Added: 0053995
2016-05-11 16:01mkvNote Added: 0053996
2016-05-11 16:01mkvTest case number => bugs fclasses bug27432
2016-05-11 16:02mkvAssigned Tomkv => kgv
2016-05-11 16:02mkvStatusreviewed => feedback
2016-05-11 16:08abvNote Added: 0053997
2016-05-11 16:09kgvAssigned Tokgv => mkv
2016-05-11 16:14gitNote Added: 0053998
2016-05-11 16:15mkvNote Added: 0053999
2016-05-11 16:15mkvAssigned Tomkv => bugmaster
2016-05-11 16:15mkvStatusfeedback => tested
2016-05-11 16:16mkvTest case numberbugs fclasses bug27432 => Not needed
2016-05-13 12:41bugmasterChangeset attached => occt master 3d370858
2016-05-13 12:41bugmasterStatustested => verified
2016-05-13 12:41bugmasterResolutionopen => fixed
2016-05-20 12:21gitNote Added: 0054178
2016-12-09 16:33aivStatusverified => closed
2016-12-09 16:37aivFixed in Version => 7.1.0

Notes
(0053574)
BenjaminBihler   
2016-04-26 10:57   
I have forgotten to add: my AIS_Trihedron creation code has worked correctly with OCCT 6.8.0.

I am prepared to give more details, but I guess that I cannot fix the issue, because I am not familiar with why there is a No_Exception macro and how to deal with exceptions, when they may not be thrown.
(0053619)
kgv   
2016-04-26 19:54   
Could you please comment why do you report it as a bug?
As far as I understand the context, application does not define required OCCT resources to use this functionality:
http://dev.opencascade.org/doc/overview/html/index.html#OCCT_OVW_SECTION_4_2 [^]
(0053621)
git   
2016-04-26 21:25   
Branch CR27432 has been created by abv.

SHA-1: a7be819e791ce13b0949fdc85bbfa2f232f84510


Detailed log of new commits:

Author: abv
Date: Tue Apr 26 21:24:27 2016 +0300

    0027432: Null Handle Access When Creating AIS_Trihedron
    
    Debug-only "RaiseIf" is replaced by simple "if" to have exceptional situation handled correctly in Release mode.
(0053622)
abv   
2016-04-26 21:25   
Benjamin, I have pushed correction to branch CR27432, could you please check whether it helps you?
(0053661)
BenjaminBihler   
2016-04-28 11:19   
Sorry for answering so late, I have been out-of-office yesterday.

Kirill, thank you for the hint. You are right - setting CSF_UnitsDefinition and CSF_UnitsLexicon environment variables makes the problem go away.

Andrey, thank you for the fix, it works. In my opinion this is a great improvement, since application crashes due to forgotten environment variables cannot be considered as good design. In fact, your change makes setting the environment variables mentioned above even unnecessary for creating an AIS_Trihedron.

I am glad to see that there is already work going on on the related issue 0027258. Actually the environment variables (shaders and units) have been a major part of my porting work from 6.8.0 to 7.0.0. If I have not missed anything, the environment variables have not been mentioned in the upgrade guides.
(0053850)
git   
2016-05-05 15:47   
Branch CR27432 has been updated by kgv.

SHA-1: ec51045bd5564ca698250e12081114b79951c370


Detailed log of new commits:

Author: kgv
Date: Thu May 5 15:47:52 2016 +0300

    Mention mandatory variable CSF_ShadersDirectory in porting notes for OCCT 6.9.0

(0053917)
abv   
2016-05-09 12:49   
Reviewed, please test
(0053943)
git   
2016-05-10 12:39   
Branch CR27432 has been updated forcibly by mkv.

SHA-1: 6edd1dfbab086b74cd8d9641bc294ad577c553fb
(0053993)
mkv   
2016-05-11 16:00   
Dear BugMaster,
Branch CR27432 was rebased on current master of occt git-repository.
SHA-1: 6edd1dfbab086b74cd8d9641bc294ad577c553fb
(0053994)
mkv   
2016-05-11 16:00   
Dear BugMaster,
Branch CR27432 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 6edd1dfbab086b74cd8d9641bc294ad577c553fb

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 72 (72 on master)
Windows: 4 (4 on master)
MacOS : 1119

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
http://occt-tests/CR27432-master-OCCT/Debian70-64/bugs/fclasses/bug27432.html [^]
http://occt-tests/CR27432-master-OCCT/Windows-64-VC10/bugs/fclasses/bug27432.html [^]
bugs fclasses bug27432: OK

Testing on Linux:
occt component :
Total MEMORY difference: 87700114 / 87499965 [+0.23%]
Total CPU difference: 19337.210000000123 / 19370.860000000182 [-0.17%]
products component :
Total MEMORY difference: 27857964 / 27839978 [+0.06%]
Total CPU difference: 5352.689999999983 / 5344.489999999986 [+0.15%]

Testing on Windows:
occt component :
Total MEMORY difference: 55528604 / 55549122 [-0.04%]
Total CPU difference: 17921.84728289889 / 18280.618382698816 [-1.96%]
products component :
Total MEMORY difference: 18922444 / 18891436 [+0.16%]
Total CPU difference: 5041.234715399943 / 5013.591338199941 [+0.55%]

There are no differences in images found by testdiff.
(0053995)
git   
2016-05-11 16:00   
Branch CR27432 has been updated by mkv.

SHA-1: 042845f72a77a118fe4bccc3678d42985b0ec5b4


Detailed log of new commits:

Author: mkv
Date: Wed May 11 15:24:17 2016 +0300

    Test cases for issue CR27432

(0053996)
mkv   
2016-05-11 16:01   
Dear kgv,
could you please review following test case
bugs fclasses bug27432
(0053997)
abv   
2016-05-11 16:08   
As agreed, please remove test as it is not able to show problem in standard test environment
(0053998)
git   
2016-05-11 16:14   
Branch CR27432 has been updated by mkv.

SHA-1: 19905df2c0c97049c9d2a88cd3cf4ead9ad68906


Detailed log of new commits:

Author: mkv
Date: Wed May 11 16:14:41 2016 +0300

    Deleting test cases for issue CR27432

(0053999)
mkv   
2016-05-11 16:15   
Dear BugMaster,
Branch CR27432 is TESTED.
(0054178)
git   
2016-05-20 12:21   
Branch CR27432 has been deleted by inv.

SHA-1: 19905df2c0c97049c9d2a88cd3cf4ead9ad68906