gabr42/OmniThreadLibrary

Range check error at Initialization

SPepoli opened this issue · 2 comments

Hello,

We noticed a range check error occurring during initialization of Otl classes, just at program startup.
Here is the stack :

010244ff +07f ******.exe   OtlCommon 3927  +3 TOmniNUMANode.Create
010263aa +1ea ******.exe   OtlCommon 4249 +20 TOmniEnvironment.LoadNUMAInfo
01025e90 +0e0 ******.exe   OtlCommon 4167  +7 TOmniEnvironment.Create
0102891f +08f ******.exe   OtlCommon 4995  +4 initialization
004124e6 +066 ******.exe   System             InitUnits
00412575 +055 ******.exe   System             @StartExe
0041f1bc +06c ******.exe   SysInit            @InitExe
02d2cd70 +020 ******.exe   ******     404  +0 initialization
7ffba974 +00e KERNEL32.DLL                    BaseThreadInitThunk
7ffbab23 +01b ntdll.dll                       RtlUserThreadStart

The line causing the error is the following one :
FAffinity.AsMask := affinity;

It looks like "affinity" is of type NativeUInt (=UInt64 in this case, max. 2^64-1) when "FAffinity.AsMask" is of type Int64 (max. 2^63-1).

This happens on a computer with the following specs :

operating system   : Windows 10 x64 build 19041
processors         : 16x AMD Ryzen Threadripper 3970X 32-Core Processor
physical memory    : 251695/262039 MB (free/total)

Any help/quickfix appreciated

Hello,

Thanks for this fix. But, I keep noticing a range check error, but somewhere else in the code, here's the stack:

0105fe1b +01b ******.exe   OtlCommon       3789    +3 TOmniAffinity.GetCount
010c4911 +091 ******.exe   OtlParallel     2446    +2 TOmniParallelLoopBase.Create

This is probably due to the same type of error, because the line causing the error is:
affMask := Mask;

And affMask is declared as a DWORD while Mask is a NativeUInt property.
The issue also occurs on a computer with an AMD Ryzen Threadripper processor.

Indeed, thanks for pointing it out! Fixed now.