View Issue Details

IDProjectCategoryView StatusLast Update
0025717CommunityOCCT:Foundation Classespublic2015-05-14 15:32
ReporterRoman Lygin Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version6.8.0 
Target Version6.9.0Fixed in Version6.9.0 
Summary0025717: Non reentrant (and hence non-thread-safe) math_RealRandom / _IntegerRandom
Descriptionmath_*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.
Steps To ReproduceN/A
Additional information
and documentation updates
_RealRandom and _IntegerRandom are going to be created as instantiation of common template class
TagsNo tags attached.
Test case numberNot needed

Activities

git

2015-01-17 18:11

administrator   ~0036176

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

abv

2015-01-18 21:29

manager   ~0036179

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.

git

2015-01-18 21:30

administrator   ~0036180

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

abv

2015-01-18 21:31

manager   ~0036181

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.

git

2015-01-19 08:19

administrator   ~0036185

Branch CR25717_1 has been updated forcibly by aml.

SHA-1: 247fbed91f08f5c78250d044d024e669c7785a82

aml

2015-01-19 08:22

developer   ~0036186

Minor corrections has been added.

Reviewed. Please test.

git

2015-01-23 19:12

administrator   ~0036480

Branch CR25717_1 has been updated forcibly by apv.

SHA-1: 8f47864dfc2bc40f71dd8a6b62bec835fb1de2e4

apv

2015-01-23 19:12

tester   ~0036481

Branch CR25717_1 has been rebased on the current master

apv

2015-01-29 13:30

tester   ~0036811

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

git

2015-03-18 13:36

administrator   ~0038561

Branch CR25717 has been deleted by inv.

SHA-1: 69dd7501d908f1872353fdf4907763bbc1476b32

git

2015-03-18 13:36

administrator   ~0038562

Branch CR25717_1 has been deleted by inv.

SHA-1: 8f47864dfc2bc40f71dd8a6b62bec835fb1de2e4

Related Changesets

occt: master fd3ba7a1

2015-01-18 14:08:40

abv


Committer: bugmaster Details Diff
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.
Affected Issues
0025717
mod - src/BRepClass3d/BRepClass3d_SClassifier.cxx Diff File
mod - src/math/math.cdl Diff File
rm - src/math/math_IntegerRandom.cdl Diff File
rm - src/math/math_IntegerRandom.cxx Diff File
rm - src/math/math_RealRandom.cdl Diff File
rm - src/math/math_RealRandom.cxx Diff File
mod - src/math/math_Recipes.cxx Diff File
mod - src/math/math_Recipes.hxx Diff File

Issue History

Date Modified Username Field Change
2015-01-17 10:08 Roman Lygin New Issue
2015-01-17 10:08 Roman Lygin Assigned To => abv
2015-01-17 18:11 git Note Added: 0036176
2015-01-17 18:11 Roman Lygin Status new => resolved
2015-01-17 18:11 Roman Lygin Steps to Reproduce Updated
2015-01-18 21:29 abv Note Added: 0036179
2015-01-18 21:30 git Note Added: 0036180
2015-01-18 21:31 abv Note Added: 0036181
2015-01-18 21:31 abv Assigned To abv => aml
2015-01-19 08:19 git Note Added: 0036185
2015-01-19 08:22 aml Note Added: 0036186
2015-01-19 08:22 aml Assigned To aml => bugmaster
2015-01-19 08:22 aml Status resolved => reviewed
2015-01-23 16:28 apv Assigned To bugmaster => apv
2015-01-23 19:12 git Note Added: 0036480
2015-01-23 19:12 apv Note Added: 0036481
2015-01-29 13:29 apv Test case number => Not needed
2015-01-29 13:30 apv Note Added: 0036811
2015-01-29 13:30 apv Assigned To apv => bugmaster
2015-01-29 13:30 apv Status reviewed => tested
2015-01-30 14:00 bugmaster Changeset attached => occt master fd3ba7a1
2015-01-30 14:00 bugmaster Status tested => verified
2015-01-30 14:00 bugmaster Resolution open => fixed
2015-03-18 13:36 git Note Added: 0038561
2015-03-18 13:36 git Note Added: 0038562
2015-05-14 15:29 aiv Status verified => closed
2015-05-14 15:32 aiv Fixed in Version => 6.9.0