Search Issue Tracker
Active
Under Consideration for 2.5.X
Votes
0
Found in [Package]
2.5.X -Collections
7000.0.0a1
Issue ID
ECSB-1246
Regression
No
InvalidOperationException error or crash when allocating a large NativeParallelHashSet
Reproduction steps:
1. Open the attached project "Project"
2. Attach “Assets/OverflowTest.cs“ to “MainCamera” GameObject
3. Enter the Play mode
4. Observe the console
Expected result: HashSet is created and memory is allocated for it
Actual result: InvalidOperation error is thrown or Editor crashes if the size is increased
Reproducible with: 2.4.2 (2022.3.39f1, 6000.0.12f1)
Couldn’t test with: 1.2.4 (2021.3.40f1) - (error CS0246: The type or namespace name 'NativeParallelHashSet<>' could not be found )
Reproducible on: Windows 10
Not reproducible on: No other environment tested
Notes:
Crashes when allocating a larger HashSet (double the initial capacity in OverflowTest.cs to reproduce the crash)
Calculations in the CalculateDataSize function in UnsafeParallelHashMap.cs appear to hit the integer limit which causes a negative value to be returned, changing var to long resolves the error, this can be seen in the “ProjectWithEditedHashSet“ project, the crash still occurs with the increased size though
First few lines of stack trace:
{noformat}0x00007FFBB304C68E (Unity) memcpy
0x00007FFBAF83FC11 (Unity) UnsafeUtility_CUSTOM_MemCpy
0x000001CBA100FD88 (Mono JIT Code) (wrapper managed-to-native) Unity.Collections.LowLevel.Unsafe.UnsafeUtility:MemCpy (void,void,long)
0x000001CC6D4E2B5B (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\UnsafeParallelHashMap.cs:175] Unity.Collections.LowLevel.Unsafe.UnsafeParallelHashMapData:ReallocateHashMap<short3, bool> (Unity.Collections.LowLevel.Unsafe.UnsafeParallelHashMapData*,int,int,Unity.Collections.AllocatorManager/AllocatorHandle)
0x000001CC6D4E2953 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\UnsafeParallelHashMap.cs:1196] Unity.Collections.LowLevel.Unsafe.UnsafeParallelHashMap`2<short3, bool>:set_Capacity (int)
0x000001CC6D4E2893 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\NativeParallelHashMap.cs:169] Unity.Collections.NativeParallelHashMap`2<short3, bool>:set_Capacity (int)
0x000001CC6D4E2763 (Mono JIT Code) [.\Library\PackageCache\com.unity.collections\Unity.Collections\NativeParallelHashSet.cs:71] Unity.Collections.NativeParallelHashSet`1<short3>:set_Capacity (int) {noformat}
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- UI Builder Scrollview is unable to scroll all the way down when the window is downsized vertically
- Celestial bodies order remains unchanged when the Distance setting is modified
- A memory leak occurs with massive terrain when camera position changes occur.
- No valid hits are returned when using RaycastCommand
- Camera is not overlooking the main Scene in Scene View in the HDRP Sample Template
Add comment