MantisBT - Community
View Issue Details
0025717Community[OCCT] OCCT:Foundation Classespublic2015-01-17 10:082015-05-14 15:32
Roman Lygin 
bugmaster 
normalminor 
closedfixed 
[OCCT] 6.8.0 
[OCCT] 6.9.0[OCCT] 6.9.0 
Not needed
0025717: Non reentrant (and hence non-thread-safe) math_RealRandom / _IntegerRandom
math_*Random uses a function Random2() declared in math_Recipes.hxx. Random2 uses static array and index into that array.

math_RealRandom is used by BRepClass3d_SClassifier which is used by Shape Healing and reinitializes the static arrays over and over again.

The fix will move the above array into a member field.
N/A
_RealRandom and _IntegerRandom are going to be created as instantiation of common template class
No tags attached.
Issue History
2015-01-17 10:08Roman LyginNew Issue
2015-01-17 10:08Roman LyginAssigned To => abv
2015-01-17 18:11gitNote Added: 0036176
2015-01-17 18:11Roman LyginStatusnew => resolved
2015-01-17 18:11Roman LyginSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=9080#r9080
2015-01-18 21:29abvNote Added: 0036179
2015-01-18 21:30gitNote Added: 0036180
2015-01-18 21:31abvNote Added: 0036181
2015-01-18 21:31abvAssigned Toabv => aml
2015-01-19 08:19gitNote Added: 0036185
2015-01-19 08:22amlNote Added: 0036186
2015-01-19 08:22amlAssigned Toaml => bugmaster
2015-01-19 08:22amlStatusresolved => reviewed
2015-01-23 16:28apvAssigned Tobugmaster => apv
2015-01-23 19:12gitNote Added: 0036480
2015-01-23 19:12apvNote Added: 0036481
2015-01-29 13:29apvTest case number => Not needed
2015-01-29 13:30apvNote Added: 0036811
2015-01-29 13:30apvAssigned Toapv => bugmaster
2015-01-29 13:30apvStatusreviewed => tested
2015-01-30 14:00bugmasterChangeset attached => occt master fd3ba7a1
2015-01-30 14:00bugmasterStatustested => verified
2015-01-30 14:00bugmasterResolutionopen => fixed
2015-03-18 13:36gitNote Added: 0038561
2015-03-18 13:36gitNote Added: 0038562
2015-05-14 15:29aivStatusverified => closed
2015-05-14 15:32aivFixed in Version => 6.9.0

Notes
(0036176)
git   
2015-01-17 18:11   
Branch CR25717 has been created by Roman Lygin.

SHA-1: 69dd7501d908f1872353fdf4907763bbc1476b32


Detailed log of new commits:

Author: Roman Lygin
Date: Sat Jan 17 18:10:18 2015 +0400

    0025717: Non reentrant (and hence non-thread-safe) math_RealRandom / _IntegerRandom
(0036179)
abv   
2015-01-18 21:29   
Class IntegerRandom is never used in OCCT thus I believe it can be safely removed, then there is no need in template and we could keep single class RealRandom to contain all the code. Furthermore, RealRandom is used in single place in OCCT, BRepClass3d_SClassifier, and this place supposedly does not require high-quality random numbers (it is just probing points on faces). Hence we can use simple random generator here, such as class added recently in math package, BullardGenerator. In applications requiring high-quality randoms, it is better to use STL generators provided by <random> in C++11, such as mt19937.
(0036180)
git   
2015-01-18 21:30   
Branch CR25717_1 has been created by abv.

SHA-1: 291ff23ab58076e885a17adbcc1f87982fb2c744


Detailed log of new commits:

Author: abv
Date: Sun Jan 18 17:08:40 2015 +0300

    0025717: Non reentrant (and hence non-thread-safe) math_RealRandom / _IntegerRandom
    
    Classes math_IntegerRandom and math_RealRandom, and method Random2 in math_Recipes, removed. Class math_BullardGenerator is used instead
(0036181)
abv   
2015-01-18 21:31   
I propose alternative patch in branch CR25717_1, where old random generator from math_Recipes is removed and math_BullardGenerator is used instead of it in BRepClass3d_SClassifier. Please review.
(0036185)
git   
2015-01-19 08:19   
Branch CR25717_1 has been updated forcibly by aml.

SHA-1: 247fbed91f08f5c78250d044d024e669c7785a82
(0036186)
aml   
2015-01-19 08:22   
Minor corrections has been added.

Reviewed. Please test.
(0036480)
git   
2015-01-23 19:12   
Branch CR25717_1 has been updated forcibly by apv.

SHA-1: 8f47864dfc2bc40f71dd8a6b62bec835fb1de2e4
(0036481)
apv   
2015-01-23 19:12   
Branch CR25717_1 has been rebased on the current master
(0036811)
apv   
2015-01-29 13:30   
Dear BugMaster,

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

Number of compiler warnings:
occt component:
   Linux: 18 (18 on master)
   Windows: 0 (0 on master)
products component :
   Linux: 11 (11 on master)
   Windows: 1 (1 on master)

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 369400184 / 370114884
Total CPU difference: 53026.35000000031 / 51750.710000000094

Testing on Windows:
Total MEMORY difference: 275891060 / 275769192
Total CPU difference: 34125.078125 / 38148.296875
(0038561)
git   
2015-03-18 13:36   
Branch CR25717 has been deleted by inv.

SHA-1: 69dd7501d908f1872353fdf4907763bbc1476b32
(0038562)
git   
2015-03-18 13:36   
Branch CR25717_1 has been deleted by inv.

SHA-1: 8f47864dfc2bc40f71dd8a6b62bec835fb1de2e4