DiscussionsIssue archiveOCCT:Modeling Algorithms

Archived issue #0022550

Fixing data races

CommunityOCCT:Modeling Algorithmsclosed16 public notes

Search issues

Description

RLN contribution.
fix385.
-------
- Summary: Port on Linux and MacOS
- Detailed description:
        - Makefile.* in ./make/TKernel/ and TKDraw
        - AdvApp2Var_ApproxF2var.cxx uses Max() and Min() instead of max(), min().
        - NCollection_BaseAllocator::CommonAllocator() avoids using
Standard_Mutex::Sentry as it uses
          static Standard_Mutex (see Standard_ErrorHandler.cxx) which may be
uninitialized yet
        - Standard_Atomic.hxx : atomic operations for MacOS are the same as for
Linux
        - AdvApp2Var: renamed macros abs, min, max to advapp_* to avoid name
conflicts on Linux/Mac which forces
          gcc to use standard C functions and therefore run-time fails (e.g.
integer abs(0.92) on Mac will return
          integer 0, not double 0.92).
- Dependency: All previous fixes, as this one is just a port of update 4 to
other platforms

fix325.
------
- Summary: More corrections for thread safety
- Detailed description:
        - PLib
- Dependency: None

fix350
- Summary: Improvement of thread-safety by adopting class _EvaluationFunction
instead of a function.
- Detailed description:
        - Modifications analogous to ones introduced in 6.3.1 for AdvApprox et all.
        - BSplSLib, BSplCLib, AdvApp2Var_EvaluatorFunc2Var
        - GeomConvert (removes fix265 modifs), Geom2dConvert, GeomLib, GeomPlate

        AdvApp2Var contains a lot of Fortran-derived code which uses static
variables. Conversion into class
        members will be a heavy and attention-required task. Until that done,
any call to AdvApp2Var (or
        algorithms using it - such GeomApprox_Surface called from ShapeHealing
BSplineRestriction or GeomPlate)
        require use of global lock.
- Dependency: None

fix265
------
- Summary: Thread-safety/re-entrability improvements
- Detailed description:
    GeomConvert_ApproxCurve/_Surface - protect shared resource with mutex (cannot
make shared resource local)
    IntCurve_IntPolyPolygen.gxx - make variable local (though it's out of use
effectively)
    Intf_* - make static vars either const for explicity, or class members, or
local variables; for some class this required to move static function as private
method
    IntcurvesFace - make static variables local
    IntCurveSurface - make static variables local and const where possible
    BRep_Tool - local instead of static
 (+fixes for UVBox)
    IntImp - use of local buffers and wrapping with arrays (to avoid heap
allocation and adverse impact on performance)
    BRepLib - local instead of static, using mutex
    ProjLib - made static var a class field
    
    Approx - made static var a class field, use of mutex (like in GeomConvert_Approx)
    BRepclass3d - local instead of static; _SolidExplorer.cxx - simplified code,
made static var a class field, local instead of static
 Everywhere to use Sentry !!!

fix335
------
- Summary: Corrected modifications in fix265 in ProjLib to restore functions
signature.
- Detailed description: Corrected modifications in fix265 in ProjLib where
signature of methods was changed from const to non-const. This
     hade the fact that virtual method were not overridden what caused exception
when using ProjLib_CompProjectCurve
     (in GeomPlate algorithm). Now the fix usis const_cast in run-time.
- Dependency: none (no direct dependence on fix265)

fix395
- Summary: A set of fixes to enable thread-safety
- Detailed description:
    - Plate_Plate now uses field members instead of static variables
        - U2, R and L should be local variables by their meaning. However, there are
some corner cases in 6.3.1
         implementation when they should inherit their values from Uold, Vold, not
U,V. I preserved current behavior by
         using member fields, but with deep code review this can be changed by OCC team.
    - ProjLib_CompProjectedCurve, Approx and BRepAlgo_NormalProjection now use
chronometers in a special compile mode (not in plain debug)
- Dependency: fix265

Public activity

16 archived notes

Participants are labeled by their role within this record.

01Commenter 2
Dear Commenter 1,

patch was reviewed and was integrated to SVN branch
http://svn/svn/occt/branches/OCC22550 with remarks applied.

Branch is ready for testing.
02Commenter 2
Dear Commenter 1,
Compile error

Error : Failed : GeomPlate_MakeApprox.cxx
Info : ----------------------- Compilation Report -----------------------
Info : Failed : :KAS:dev:ycy-occt-3:GeomPlate:source:GeomPlate_MakeApprox.cxx
Info : -----------------------------------------------------------------
Error : Failed during execution
Info : Step obj.comp
Error : Step obj.comp iled
#######################################
Error : Failed : GeomLib.cxx
Info : ----------------------- Compilation Report -----------------------
Info : Failed : :KAS:dev:ycy-occt-3:GeomLib:source:GeomLib.cxx
Info : -----------------------------------------------------------------
Error : Failed during execution
Info : Step obj.comp
Error : Step obj.comp failed
#######################################
Error : Failed : GeomConvert_ApproxSurface.cxx
Info : ----------------------- Compilation Report -----------------------
Info : Failed : :KAS:dev:ycy-occt-3:GeomConvert:source:GeomConvert.cxx
Info : Failed :
:KAS:dev:ycy-occt-3:GeomConvert:source:GeomConvert_ApproxSurface.cxx
Info : -----------------------------------------------------------------
Error : Failed during execution
Info : Step obj.comp
Error : Step obj.comp failed
#####################################
Error : Failed : Geom2dConvert.cxx
Info : ----------------------- Compilation Report -----------------------
Info : Failed : :KAS:dev:ycy-occt-3:Geom2dConvert:source:Geom2dConvert.cxx
Info : -----------------------------------------------------------------
Error : Failed during execution
Info : Step obj.comp
Error : Step obj.comp failed
03Commenter 2
Sorry,

there are several files uncommitted in these packages.
Please re-check again (update branch).
04Commenter 4
Dear Commenter 1,

=====> DRAWEXE:exec.libs
 
Info : ========> DRAWEXE
Error : Cyclic dependency detected between: PLib BSplCLib
Error : Failed during execution
Error : ========> DRAWEXE failed
Error : Failed during execution
Info : Step exec.libs
Error : Step exec.libs failed
Error : Step exec.tks not done : almost DRAWEXE:exec.libs failed
Error : Step exec.link not done : almost DRAWEXE:exec.tks failed
05Commenter 2
>>Cyclic dependency detected between: PLib BSplCLib
corrected
06Commenter 6
Dear Commenter 1,
Compile error
Intf_InterferencePolygon2d.gxx

Error : Failed : QMTools_IntPolySeg2d.cxx
Info : ----------------------- Compilation Report -----------------------
Info : Failed : :KAS:dev:products-22576:QMTools:source:QMTools_IntPolySeg2d.cxx
Info : -----------------------------------------------------------------
Error : Failed during execution
Info : Step obj.comp
Error : Step obj.comp failed
07Commenter 2
>>Error : Failed : QMTools_IntPolySeg2d.cxx
Please use http://svn/svn/occt-products/branches/OCC22550 branch to build
products (1 file changed).
08Commenter 8
Dear Commenter 1,
SVN branch ( http://svn/svn/occt/branches/OCC22550 ) was
testing, test results were compared with KAS:dev:products-651-opt

Regressions
chl 937 A7

See results in /QADisk/occttests/results/KAS/dev/products-22576_25072011/lin/
See reference results in
/QADisk/occttests/results/KAS/dev/products-651-opt_01062011/lin
See test cases in /QADisk/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions
http://sbu.nnov.opencascade.com/maintenance/main_certification_te.html [^]

09Commenter 1
Dear Kiril,

SZY ask to include this fix to OCCT 6.5.2
Could you please analyze last regression:
chl 937 A7
10Commenter 2
Part of changes in AdvApp2Var package were reverted. It seems this static hell from Fortran->C->C++ couldn't be eliminated in one shoot.

Please perform tests again. Notice that test case chl 937 A7 should pass now however values and snapshot are slightly different thus test case should be probably updated.
11Commenter 11
Dear Commenter 1,

Wokbench KAS:dev:mkv-OCC22550-products was tested.
Following regressions were found:

bom 016 Q1 Q2 Q3 Q4
bom 019 A3 K2 K3 K4 L2 L3 L4 M2 M3 N2 N3 N4
bom 102 B5 B6 B6 C3 C4 C5 F3 F4 F5 R6 T1 T5
bom 900 B1 G1 G1 G2 G3 J4 K2 L9 M9 Q2 Q6
bom 904 B1 B3 C1 C4 H9 J5 J6 J7 L6 M3

chp 006 A1 A2 A3 A4 A5 A6 A7 A8 A9 B1 B2 B3 B5

emh ALL GROUP

Results here
/QADisk/occttests/results/KAS/dev/mkv-OCC22550-products_22092011/lin
--
[signature removed]
Mike

12Commenter 12
Dear Kirill,

See test results at the previous note.

--
[signature removed]
Mike

13Commenter 13
I have merged the code of the branch with trunk (checked compilation only on Windows); please test in the current version
14Commenter 14
Dear Commenter 1,
Workbench KAS:dev:mkv-OCC22550-occt was created from SVN branch http://svn/svn/occt/branches/OCC22550
(and mkv-OCC22550-products from trunk) and compiled on Linux platform.

There are not regressions in mkv-OCC22550-products regarding to KAS:dev:products-20120117-opt

See results in /QADisk/occttests/results/KAS/dev/mkv-OCC22550-products_23012012/lin
See reference results in /QADisk/occttests/results/KAS/dev/products-20120117-opt_17012012/lin
See test cases in /QADisk/occttests/tests/ED
N.B. In order to launch testing case you can make use the following instructions
http://doc/doku.php?id=occt:certification
15Commenter 1
Integration into trunk of occt repository

Date: 2012-01-27 18:12:59 +0400 (Fri, 27 Jan 2012)
New Revision: 10183

Added:
   trunk/src/BRepBuilderAPI/BRepBuilderAPI_BndBoxTreeSelector.hxx
   trunk/src/BRepBuilderAPI/BRepBuilderAPI_CellFilter.hxx
   trunk/src/BRepBuilderAPI/BRepBuilderAPI_VertexInspector.hxx
   trunk/src/BRepBuilderAPI/FILES
   trunk/src/PLib/PLib_LocalArray.hxx
   trunk/src/TCollection/TCollection_ExtendedString.lxx
Removed:
   trunk/src/BRepBuilderAPI/BRepBuilderAPI_BndBoxTreeSelector.hxx
   trunk/src/BRepBuilderAPI/BRepBuilderAPI_CellFilter.hxx
   trunk/src/BRepBuilderAPI/BRepBuilderAPI_VertexInspector.hxx
   trunk/src/BRepBuilderAPI/FILES
   trunk/src/TCollection/TCollection_ExtendedString.lxx
Modified:
   trunk/src/AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cdl
   trunk/src/AdvApp2Var/AdvApp2Var_ApproxAFunc2Var.cxx
   trunk/src/AdvApp2Var/AdvApp2Var_ApproxF2var.cxx
   trunk/src/AdvApp2Var/AdvApp2Var_ApproxF2var.hxx
   trunk/src/AdvApp2Var/AdvApp2Var_Data_f2c.hxx
   trunk/src/AdvApp2Var/AdvApp2Var_EvaluatorFunc2Var.hxx
   trunk/src/AdvApp2Var/AdvApp2Var_MathBase.cxx
   trunk/src/AdvApp2Var/AdvApp2Var_SysBase.cxx
   trunk/src/Approx/Approx_ComputeLine.cdl
   trunk/src/Approx/Approx_ComputeLine.gxx
   trunk/src/Approx/Approx_CurvilinearParameter.cxx
   trunk/src/Approx/Approx_CurvlinFunc.cdl
   trunk/src/Approx/Approx_CurvlinFunc.cxx
   trunk/src/BRepAlgo/BRepAlgo_NormalProjection.cxx
   trunk/src/BRepClass3d/BRepClass3d_Intersector3d.cxx
   trunk/src/BRepClass3d/BRepClass3d_SolidExplorer.cdl
   trunk/src/BRepClass3d/BRepClass3d_SolidExplorer.cxx
   trunk/src/BRepLib/BRepLib.cxx
   trunk/src/BRepLib/BRepLib_MakeEdge.cxx
   trunk/src/BSplCLib/BSplCLib.cxx
   trunk/src/BSplCLib/BSplCLib_1.cxx
   trunk/src/BSplCLib/BSplCLib_2.cxx
   trunk/src/BSplCLib/BSplCLib_3.cxx
   trunk/src/BSplCLib/BSplCLib_CurveComputation.gxx
   trunk/src/BSplCLib/BSplCLib_EvaluatorFunction.hxx
   trunk/src/BSplSLib/BSplSLib.cxx
   trunk/src/BSplSLib/BSplSLib_EvaluatorFunction.hxx
   trunk/src/CSLib/CSLib.cxx
   trunk/src/CSLib/CSLib_NormalPolyDef.cxx
   trunk/src/Geom2dConvert/Geom2dConvert.cxx
   trunk/src/GeomConvert/GeomConvert.cxx
   trunk/src/GeomConvert/GeomConvert_ApproxSurface.cxx
   trunk/src/GeomLib/GeomLib.cxx
   trunk/src/GeomPlate/GeomPlate_MakeApprox.cxx
   trunk/src/IntCurve/IntCurve_IntPolyPolyGen.gxx
   trunk/src/IntCurveSurface/IntCurveSurface_CurveTool.gxx
   trunk/src/IntCurveSurface/IntCurveSurface_HCurveTool.gxx
   trunk/src/IntCurveSurface/IntCurveSurface_Inter.gxx
   trunk/src/IntCurveSurface/IntCurveSurface_Polyhedron.gxx
   trunk/src/IntImp/IntImp_Int2S.gxx
   trunk/src/IntImp/IntImp_IntCS.gxx
   trunk/src/Intf/Intf_Interference.cxx
   trunk/src/Intf/Intf_InterferencePolygon2d.cdl
   trunk/src/Intf/Intf_InterferencePolygon2d.gxx
   trunk/src/Intf/Intf_InterferencePolygon3d.cdl
   trunk/src/Intf/Intf_InterferencePolygon3d.gxx
   trunk/src/Intf/Intf_InterferencePolygonPolyhedron.cdl
   trunk/src/Intf/Intf_InterferencePolygonPolyhedron.gxx
   trunk/src/Intf/Intf_InterferencePolyhedron.cdl
   trunk/src/Intf/Intf_InterferencePolyhedron.gxx
   trunk/src/Intf/Intf_Tool.cdl
   trunk/src/Intf/Intf_Tool.cxx
   trunk/src/PLib/FILES
   trunk/src/PLib/PLib.cdl
   trunk/src/PLib/PLib.cxx
   trunk/src/PLib/PLib.lxx
   trunk/src/PLib/PLib_HermitJacobi.cxx
   trunk/src/Plate/Plate_Plate.cdl
   trunk/src/Plate/Plate_Plate.cxx
   trunk/src/ProjLib/ProjLib_CompProjectedCurve.cdl
   trunk/src/ProjLib/ProjLib_CompProjectedCurve.cxx

16Commenter 1
Integration into trunk of occt-products repository

Date: 2012-01-28 14:24:12 +0400 (Sat, 28 Jan 2012)
New Revision: 18517

Modified:
   trunk/src/QMTools/QMTools_IntPolySeg2d.hxx