Search Issue Tracker
By Design
Votes
0
Found in [Package]
1.8.2
Issue ID
BUR-2142
Regression
No
NativeHashSet Capacity Accessor triggers exception when scheduled for jobs
Steps to reproduce:
1. Open the attached user's project "JobsTest.zip"
2. Open the "SampleScene.unity"
3. Enter Play Mode
4. Observe the Console window
Expected results: NativeHashSet Capacity Accessor does not trigger an exception when scheduled for jobs
Actual results: NativeHashSet Capacity Accessor triggers an exception when scheduled for jobs
Reproducible on: Burst 1.6.6 - 1.8.2 (2020.3.41f1, 2021.3.15f1, 2022.2.1f1, 2023.1.0a23)
Notes:
-Exception outputted:
InvalidOperationException: The previously scheduled job JobDependencyTest:GenerateIndices writes to the Unity.Collections.NativeHashSet`1[System.Int32] GenerateIndices.output.m_Data. You must call JobHandle.Complete() on the job JobDependencyTest:GenerateIndices, before you can deallocate the Unity.Collections.NativeHashSet`1[System.Int32] safely.
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckDeallocateAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <bae255e3e08e46f7bc2fbd23dde96338>:0)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- ACES Tonemapping causes banding artifacts and negative values in ColorGradingLUT when HDR is enabled and "High Dynamic Range" Grading mode is selected while Android Platform is used
- Android Player freezes when an Audio Source is playing and an incoming call is picked up and then hung up and the Audio Source is started again
- Green success icon is poorly visible in the light Unity theme
- Incorrect input into the Input Field when using Microsoft IME Japanese
- Multiplayer role "ClientAndServer" is displayed without the spaces in the "Play Mode Scenarios" window
Resolution Note:
This isn't a Burst bug, because the same thing happens with Burst disabled. And also, I don't think there's a bug here. The error message says correctly that you must call JobHandle.Complete() before disposing the output data used in the job. And I think the user was aware of this, because the sample project contains a commented-out line that does the correct thing: generatorHandles[0].Complete();.
Note that you must call Complete before accessing the NativeHashSet Capacity, because the job system has detected that the NativeHashSet is used in the job, so it's only safe to access it after the job has completed.