View Issue Details

IDProjectCategoryView StatusLast Update
0027357CommunityOCCT:Modeling Algorithmspublic2016-12-09 16:38
Reportersraymond Assigned Tobugmaster  
PrioritylowSeveritycrash 
Status closedResolutionreopened 
PlatformWindowsOSVC++ 2015 
Product Version7.0.0 
Target Version7.1.0Fixed in Version7.1.0 
Summary0027357: Geom2dGcc_Circ2d2TanOn: check status of sub-algorithms to avoid exceptions
DescriptionWhen Geom2dGcc_Circ2d2TanOn is used in a loop it crash after a while when it's destroyed.

This bug was reported here too.

I don't get it with my mac version, the phenomena can't be reproduced with OC compiled with debug options.

http://www.opencascade.com/content/bug-geom2dgcccirc2d2tanradgeo-geom2dgcccirc2d2tanrad
Steps To ReproduceHere is an example showing how it crashes :

    TColgp_Array1OfPnt2d poles(1,3);
    poles.SetValue(1,gp_Pnt2d(0.,0.));
    poles.SetValue(2,gp_Pnt2d(0.,1.));
    poles.SetValue(3,gp_Pnt2d(6.,0.));

    Handle(Geom2d_BezierCurve) curve1 = new Geom2d_BezierCurve(poles);

    poles.SetValue(2,gp_Pnt2d(0.,1.5));

    Handle(Geom2d_BezierCurve) curve2 = new Geom2d_BezierCurve(poles);

    int nP = 100;
    int nFailed=0;
    for(int i = 0 ; i < nP ; i++){
        double u = i / (nP-1.);
        gp_Pnt2d p1;
        gp_Vec2d tangent;
        curve1->D1(u,p1,tangent);
        gp_Vec2d normal(-tangent.Y(),tangent.X());
        Handle(Geom2d_Line) normalLine=new Geom2d_Line(p1,gp_Dir2d(normal));


        Geom2dGcc_QualifiedCurve qualifiedC1(Geom2dAdaptor_Curve(curve1),GccEnt_unqualified);
        Geom2dGcc_QualifiedCurve qualifiedC2(Geom2dAdaptor_Curve(curve2),GccEnt_unqualified);

        try{
            Geom2dAPI_ProjectPointOnCurve projPc1(p1, curve1);
            double guess1 = projPc1.LowerDistanceParameter();
            Geom2dAPI_ProjectPointOnCurve projPc3(p1, normalLine);
            double guess3 = projPc3.LowerDistanceParameter();
            Geom2dGcc_Circ2d2TanOn circleBuilder(qualifiedC1,qualifiedC2,Geom2dAdaptor_Curve(normalLine),1e-9,guess1,guess1,guess3);
            int nSol = circleBuilder.NbSolutions();
            if (nSol > 0){
                gp_Circ2d circle = circleBuilder.ThisSolution(1);
                gp_Pnt2d center=circle.Location();
            }
        }
        catch(Standard_Failure){
            nFailed++;
        }
    }
TagsNo tags attached.
Test case numberbugs modalg_6 bug27357

Activities

msv

2016-04-07 11:07

developer   ~0052459

The class Geom2dGcc_Circ2d2TanOn can throw a C++ exception of type StdFail_NotDone. This is a bug caused by the fact that the algorithm does not check the status of under-called algorithms before getting a result from them.

However, it does not crash when it is destroyed in normal situation like in the given sample. If it crashes in destructor it means there is mismatched allocation/deallocation of some memory. It can occur when you link your sample program against C run-time Multithreaded Debug DLL, but use the OCCT binary files linked against C run-time Multithreaded DLL, or vice versa. This concerns the MSVC environment on Windows.

sraymond

2016-04-07 14:46

developer   ~0052470

Thanks, the example compiled in release mode doesn’t crash anymore.

msv

2016-04-07 18:59

developer   ~0052486

It is needed to fix the following problem. The class Geom2dGcc_Circ2d2TanOn throws an unexpected C++ exception of type StdFail_NotDone. In fact it is raised by other algorithms called from the discussed one. It is needed to check the status of all called sub-algorithms and not to try getting result from them if their IsDone() method returns false.

git

2016-06-17 14:51

administrator   ~0055176

Branch CR27357 has been created by isn.

SHA-1: 0725f8081dfeaad421ee65ea8a7c6f7a16fc7091


Detailed log of new commits:

Author: isn
Date: Fri Jun 17 14:50:50 2016 +0300

    0027357: Geom2dGcc_Circ2d2TanOn: check status of sub-algorithms to avoid exceptions
    
    Additional checks for underlying algorithms have been added

isn

2016-06-17 14:55

developer   ~0055178

this issue seems to be resolved, but without corrections of indentations in the Geom2dGcc_Circ2d2TanOn.cxx file.

git

2016-06-20 11:16

administrator   ~0055205

Branch CR27357 has been updated forcibly by isn.

SHA-1: 7f718aa8619de8d7e275c83c8e7721c14dd60395

msv

2016-06-20 11:51

developer   ~0055213

Last edited: 2016-06-21 10:02

Code correction is OK. Please create a test case that checks there is no exception. This test must fail on master.

git

2016-06-20 17:14

administrator   ~0055247

Branch CR27357 has been updated by isn.

SHA-1: 89d7acb8680fa1eaa54fdfe6ded6eadad977f5ed


Detailed log of new commits:

Author: isn
Date: Mon Jun 20 17:00:06 2016 +0300

    test case

msv

2016-06-21 10:08

developer   ~0055279

Reviewed.

git

2016-06-21 18:11

administrator   ~0055317

Branch CR27357 has been updated forcibly by apv.

SHA-1: af8f8a9f57684289107ad699ceed651a952876cc

apv

2016-06-21 18:12

tester   ~0055318

Branch CR27357 has been rebased on the current master

apv

2016-06-22 13:18

tester   ~0055338

Dear BugMaster,

Branch CR27357 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: af8f8a9f57684289107ad699ceed651a952876cc

Number of compiler warnings:
occt component:
   Linux: 1 (0 on master)
   Windows: 0 (0 on master)
   MacOS: 1 (0 on master)
products component:
   Linux: 68
   Windows: 0
   MacOS: 1127
New warning has been detected
on Linux:
QABugs_20.cxx:2020, GNU C Compiler 4 (gcc), Priority: Normal
variable 'aCenter' set but not used [-Wunused-but-set-variable]
on MacOS:
QABugs_20.cxx:2020, Clang (LLVM based), Priority: Normal
unused variable 'aCenter'

Regressions/Differences:
Not detected

Testing cases:
bugs modalg_6 bug27357 - OK
http://occt-tests/CR27357-master-OCCT/Debian70-64/bugs/modalg_6/bug27357.html
http://occt-tests/CR27357-master-OCCT/Windows-64-VC10/bugs/modalg_6/bug27357.html

Testing on Linux:
Total MEMORY difference: 89269260 / 89170862 [+0.11%]
Total CPU difference: 19445.259999999897 / 19458.16999999997 [-0.07%]

Testing on Windows:
Total MEMORY difference: 55890332 / 55902024 [-0.02%]
Total CPU difference: 18078.44108669884 / 18535.508416598954 [-2.47%]

apv

2016-06-22 13:19

tester   ~0055339

Dear Ilya,

Branch CR27357 has been rejected due to:
- additional warnings

git

2016-06-22 18:58

administrator   ~0055354

Branch CR27357 has been updated by isn.

SHA-1: 6c09b373b89105154f9b714c54f24d23c2302099


Detailed log of new commits:

Author: isn
Date: Wed Jun 22 18:40:21 2016 +0300

    get rid of the warning

msv

2016-06-23 09:59

developer   ~0055360

Why did you used std::list instead of NCollection_List. I consider that in OCCT code we should use OCCT collections where it is possible. Also, please use Standard_Integer instead of int.

git

2016-06-23 12:32

administrator   ~0055367

Branch CR27357 has been updated forcibly by isn.

SHA-1: 7e54f27d2f8fa9a820ab0a5f4a460db5429e2271

isn

2016-06-23 12:32

developer   ~0055368

ok, done

msv

2016-06-23 12:55

developer   ~0055370

Reviewed. Please re-test only "bugs modalg_6 bug27357". Nothing else was changed.

git

2016-06-23 17:51

administrator   ~0055390

Branch CR27357 has been updated forcibly by mkv.

SHA-1: 5de21abca67c9dc0502c212d3cea81748370e55a

apv

2016-06-24 13:54

tester   ~0055442

Dear BugMaster,

Branch CR27357 from occt git-repository (and IR-2016-06-23 from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: 5de21abca67c9dc0502c212d3cea81748370e55a

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MacOS: 0 (0 on master)
products component:
   Linux: 64
   Windows: 1
   MacOS: 1158

Regressions/Differences:
Not detected

Testing cases:
bugs modalg_6 bug27357 - OK
http://occt-tests/CR27357-master-OCCT/Debian70-64/bugs/modalg_6/bug27357.html
http://occt-tests/CR27357-master-OCCT/Windows-64-VC10/bugs/modalg_6/bug27357.html

Testing on Linux:
Total MEMORY difference: 88788517 / 88710130 [+0.09%]
Total CPU difference: 19512.540000000132 / 19559.77999999992 [-0.24%]

Testing on Windows:
Total MEMORY difference: 55888001 / 55896954 [-0.02%]
Total CPU difference: 18108.09687679883 / 17842.286772898675 [+1.49%]

git

2016-07-22 10:45

administrator   ~0056132

Branch CR27357 has been deleted by inv.

SHA-1: 5de21abca67c9dc0502c212d3cea81748370e55a

Related Changesets

occt: master 8009d070

2016-06-17 11:50:50

isn


Committer: bugmaster Details Diff
0027357: Geom2dGcc_Circ2d2TanOn: check status of sub-algorithms to avoid exceptions

Additional checks for underlying algorithms have been added

test case

get rid of the warning
Affected Issues
0027357
mod - src/Geom2dGcc/Geom2dGcc_Circ2d2TanOn.cxx Diff File
mod - src/QABugs/QABugs_20.cxx Diff File
add - tests/bugs/modalg_6/bug27357 Diff File

Issue History

Date Modified Username Field Change
2016-04-05 20:42 sraymond New Issue
2016-04-05 20:42 sraymond Assigned To => msv
2016-04-07 11:07 msv Note Added: 0052459
2016-04-07 14:46 sraymond Note Added: 0052470
2016-04-07 15:33 abv Status new => closed
2016-04-07 15:33 abv Resolution open => no change required
2016-04-07 15:33 abv Target Version 7.1.0 =>
2016-04-07 18:59 msv Note Added: 0052486
2016-04-07 18:59 msv Status closed => feedback
2016-04-07 18:59 msv Resolution no change required => reopened
2016-05-19 10:09 msv Priority normal => low
2016-05-19 10:09 msv Status feedback => assigned
2016-05-19 10:09 msv Summary Geom2dGcc_Circ2d2TanOn crash in a loop => Geom2dGcc_Circ2d2TanOn: check status of sub-algorithms to avoid exceptions
2016-06-09 18:09 msv Assigned To msv => isn
2016-06-17 14:51 git Note Added: 0055176
2016-06-17 14:55 isn Note Added: 0055178
2016-06-17 14:55 isn Assigned To isn => msv
2016-06-17 14:55 isn Status assigned => feedback
2016-06-20 11:16 git Note Added: 0055205
2016-06-20 11:51 msv Note Added: 0055213
2016-06-20 11:51 msv Assigned To msv => isn
2016-06-20 11:51 msv Status feedback => assigned
2016-06-20 17:14 git Note Added: 0055247
2016-06-20 17:15 isn Assigned To isn => msv
2016-06-20 17:15 isn Status assigned => resolved
2016-06-21 10:02 msv Note Edited: 0055213
2016-06-21 10:08 msv Note Added: 0055279
2016-06-21 10:08 msv Assigned To msv => bugmaster
2016-06-21 10:08 msv Status resolved => reviewed
2016-06-21 10:09 msv Target Version => 7.1.0
2016-06-21 11:44 apv Assigned To bugmaster => apv
2016-06-21 18:11 git Note Added: 0055317
2016-06-21 18:12 apv Note Added: 0055318
2016-06-22 13:14 apv Test case number => bugs modalg_6 bug27357
2016-06-22 13:18 apv Note Added: 0055338
2016-06-22 13:18 apv Assigned To apv => isn
2016-06-22 13:18 apv Status reviewed => assigned
2016-06-22 13:19 apv Note Added: 0055339
2016-06-22 18:58 git Note Added: 0055354
2016-06-22 18:59 isn Assigned To isn => msv
2016-06-22 18:59 isn Status assigned => resolved
2016-06-23 09:59 msv Note Added: 0055360
2016-06-23 09:59 msv Assigned To msv => isn
2016-06-23 09:59 msv Status resolved => assigned
2016-06-23 12:32 git Note Added: 0055367
2016-06-23 12:32 isn Note Added: 0055368
2016-06-23 12:32 isn Assigned To isn => msv
2016-06-23 12:32 isn Status assigned => resolved
2016-06-23 12:55 msv Note Added: 0055370
2016-06-23 12:55 msv Assigned To msv => bugmaster
2016-06-23 12:55 msv Status resolved => reviewed
2016-06-23 14:16 mkv Assigned To bugmaster => apv
2016-06-23 17:51 git Note Added: 0055390
2016-06-24 13:54 apv Note Added: 0055442
2016-06-24 13:54 apv Assigned To apv => bugmaster
2016-06-24 13:54 apv Status reviewed => tested
2016-07-01 17:19 bugmaster Changeset attached => occt master 8009d070
2016-07-01 17:19 bugmaster Status tested => verified
2016-07-22 10:45 git Note Added: 0056132
2016-12-09 16:31 aiv Status verified => closed
2016-12-09 16:38 aiv Fixed in Version => 7.1.0