Search Issue Tracker
Fixed in 0.10.0
Votes
3
Found in [Package]
0.4.0-preview.10, 0.6.0-preview.24
Issue ID
1207875
Regression
No
[ECS] Internal native array is deallocated when ComponentDataFromEntity is captured into 2 lambda jobs
How to reproduce:
1. Open the attached project ("case_1207875-NativeArray.zip")
2. Open Test Runner
3. Run the 'CdfeCaptureSharing' test
Expected results: Test succeeds
Actual results: Test fails with "System.InvalidOperationException : The NativeArray has been deallocated, it is not allowed to access it" error
Reproducible with: 2019.3.3f1, 2020.1.0a24
Couldn't test with 2017.4, 2018.4 (package is not supported)
Reproducible with package versions: 0.4.0-preview.10, 0.6.0-preview.24
Note:
On 2020.1 stream, the test fails with "System.InvalidOperationException : The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it" error
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
- Duplicate External Textures start appearing when a Texture created with "CreateExternalTexture" is modified causing Memory Usage spikes on VisionOS
- Silent crash when using a "Blend Shape" in a "Skinned Mesh Renderer" to move vertices to Vector3.positiveInfinity, and "Occlusion Culling" is baked
- Some Prefab Source and Override content bounds are misaligned
- The Package Manager's "install packages by..." panels break when Domain Reload is triggered, and the panel is open
- Crash with multiple stack traces when leaving a docked VFX Graph open
Resolution Note (fix version 0.10.0):
The issue here is that all existing ComponentDataFromEntity objects are invalidated when a structural change occurs. In this case, SimpleCdfe is invalidated by the RemoveComponent command played back by ecb.Playback(). SimpleCdfe2, if uncommented, is created after the ECB playback, so it would still be valid in the second ForEach loop.
The error message for this was awful for a long time, as you noticed (what NativeArray? What deallocation?). I'm happy to report that in 2020.1 + Entities 0.10.0 the error message is much more explicit and actionable (it would be something like "The ComponentDataFromEntity has been invalidated by a structural change".