View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0023855||Community||OCCT:Modeling Algorithms||public||2013-03-25 12:57||2014-05-05 13:37|
|Target Version||6.7.1||Fixed in Version||6.7.1|
|Summary||0023855: Old BOPs fail on Win7 64bit when using TBB|
|Description||Old BOPs fail when using OCCT with TBB on an 64 bit Windows7.|
Investigations show that the lines (30/31):
const TopOpeBRepDS_ListOfInterference* l1 = (const TopOpeBRepDS_ListOfInterference*)(*((long int*)v1));
const TopOpeBRepDS_ListOfInterference* l2 = (const TopOpeBRepDS_ListOfInterference*)(*((long int*)v2));
in TopOpeBRep_sort.cxx, in the compll-method obtain pointers that apparently do not point at valid objects and so the line 32 causes the exception:
if (l1->Extent() == 0) return (0);
The problem occurs only when MMGT_OPT=2.
32 bit version is not affected.
|Steps To Reproduce||Make sure the following environment variables are set:|
and then run DRAW:
psphere s1 10
psphere s2 10
common result s1 s2
... exception is thrown.
The script runs without problems if either MMGT_OPT=1 or MMGT_OPT=0.
|Tags||No tags attached.|
|Test case number||bugs modalg_5(010) bug23855|
can I please ask you to check if you can confirm this problem?
I know you have great experience with Intel TBB so maybe you could give a hint what causes such behaviour.
This has nothing to do with TBB actually. This code will equally fail with any allocator. TBB just seems to provoke it more aggressively, what is good.
The root-cause is likely the same as in 0022786: wrong pointer arithmetic and attempt to store a pointer in long int. On Windows 64, the size of long int is 32 bit so it loses part of the pointer.
It looks like it input parameters v1 and v2 are pointers to pointers, so following should work:
const TopOpeBRepDS_ListOfInterference* l1 = *(const TopOpeBRepDS_ListOfInterference**)(v1);
For C++ code you might want to prefer more strict reinterpret_cast<> to C-style casting:
const TopOpeBRepDS_ListOfInterference* l1 = *reinterpret_cast<const TopOpeBRepDS_ListOfInterference**>(v1);
But please check the semantics and test.
Hope this helps.
|Ohh, just realized that this was Pawel who reassigned this to me initially. Anyway, hope this will help to both of you, Pawel and Julia.|
||One observation: The problem does not occur with tbb42_20131003oss.|
I have just came across this issue when running the regression test on Windows 64bit:
test bugs fclasses bug23237
The fix has been pushed into the repository.
I have also fixed some warning "unreachable code" (interesting which the compiler did not trigger it on the original code).
As mentioned earlier, the root-cause has nothing to do with TBB. It's just plain wrong casting a pointer to long int which may fail on Windows 64 regardless of the underlying allocator.
Just small comment:
+ Standard_Address p = T; + Standard::Free(p);
the copy seems to be redundant since 0024489
Right. However I intentionally left it as is, to ease backporting to previous versions of OCC (I had to apply it to 6.7.0 at least).
Re 0024489 I have a comment to be posted there.
|Reviewed, please test. Sorry I have added one more commit to make the code around more readable (mostly adding line breaks between operators).|
|Please test also on 64-bit Windows!|
Branch CR23855 (and products from GIT master) was compiled on Linux and Windows platforms and tested.
Number of compiler warnings:
occt component :
Linux: 48 (48 on master)
Windows: 1 (1 on master)
products component :
Linux: 12 (12 on master)
Windows: 2 (2 on master)
Testing on Linux:
Total MEMORY difference: 365200936 / 365947140
Total CPU difference: 43948.98999999988 / 44021.22000000015
Testing on Windows:
Total MEMORY difference: 417067404 / 417396220
Total CPU difference: 32577.796875 / 32472.65625
There are not differences in images found by testdiff.
Branch CR23855 (and products from GIT master) was compiled on 64-bit Windows platform and tested.
bugs modalg_5 bug23855 - OK.
occt: master 091232ba
Committer: bugmaster Details Diff
|0023855: Old BOPs fail on Win7 64bit when using TBB
Minor code refactoring (readability)
Test case for issue CR23855
|mod - src/TopOpeBRep/TopOpeBRep_sort.cxx||Diff File|
|add - tests/bugs/modalg_5/bug23855||Diff File|
|2013-03-25 12:57||Pawel||New Issue|
|2013-03-25 12:57||Pawel||Assigned To||=> bugmaster|
|2013-05-14 14:09||Pawel||Assigned To||bugmaster => jgv|
|2013-05-14 14:09||Pawel||Product Version||6.5.5 => 6.6.0|
|2013-05-14 14:09||Pawel||Target Version||=> 6.7.0|
|2013-06-03 01:39||Pawel||Note Added: 0024595|
|2013-06-03 01:39||Pawel||Assigned To||jgv => Roman Lygin|
|2013-06-03 01:39||Pawel||Status||new => feedback|
|2013-06-03 08:25||Roman Lygin||Note Added: 0024596|
|2013-06-03 08:25||Roman Lygin||Assigned To||Roman Lygin => jgv|
|2013-06-03 08:25||Roman Lygin||Status||feedback => assigned|
|2013-06-03 08:26||Roman Lygin||Note Added: 0024597|
|2013-07-11 19:59||Pawel||Relationship added||related to 0024066|
||Target Version||6.7.0 => 6.7.1|
|2013-12-22 18:05||Pawel||Note Added: 0027294|
|2014-01-17 21:34||Roman Lygin||Note Added: 0027542|
|2014-01-17 21:34||Roman Lygin||Status||assigned => resolved|
|2014-01-17 22:46||kgv||Note Added: 0027543|
|2014-01-17 23:23||Roman Lygin||Note Added: 0027544|
||Note Added: 0027549|
||Assigned To||jgv => bugmaster|
||Status||resolved => reviewed|
||Assigned To||bugmaster => mkv|
||Note Added: 0027559|
||Note Added: 0027587|
||Note Added: 0027646|
||Test case number||=> bugs modalg_5(010) bug23855|
||Assigned To||mkv => bugmaster|
||Status||reviewed => tested|
|2014-02-03 10:15||bugmaster||Changeset attached||=> occt master 091232ba|
|2014-02-03 10:15||bugmaster||Status||tested => verified|
|2014-02-03 10:15||bugmaster||Resolution||open => fixed|
||Status||verified => closed|
||Fixed in Version||=> 6.7.1|