Search Issue Tracker

Active

Under Consideration for 2.6.X

Votes

0

Found in [Package]

2.6.0-exp.2 - Collections

Issue ID

ECSB-1648

Regression

No

Crash/Freeze with errors when entering/exiting Play mode and using NativeQueue in a parallel job leaks memory

Package: Unity Native Collections

-

Reproduction steps:
1. Open the attached project ("ReproProject_96077")
2. Open scene "Scenes/SampleScene"
3. Enter and Exit Play mode around 5 times

Expected result: The Editor either freezes or crashes
Actual result: The Editor enters Play mode

Reproducible with: 1.8.19 (2022.3.61f1, 6000.0.46f1, 6000.1.0b14, 6000.2.0a8)
Oldest version checked for regression: 1.6.0-pre.2 (2022.1.0a1)

Reproducible on: Windows 10 (User), macOS 15.3.2 (Intel)
Not reproducible on: No other environment tested

Notes:
1. The Editor would sometimes freeze/crash on the first try. Other times, it took 3 Play mode enter/exit cycles.
2. Errors/Stacktraces:
NullReferenceException: Object reference not set to an instance of an object
at Unity.Collections.UnsafeQueueBlockPoolData.AllocateBlock () [0x00064] in ./Library/PackageCache/com.unity.collections@9922678e06a0/Unity.Collections/UnsafeQueue.cs:59
at Unity.Collections.UnsafeQueueData.AllocateWriteBlockMT[T] (Unity.Collections.UnsafeQueueData* data, Unity.Collections.UnsafeQueueBlockPoolData* pool, System.Int32 threadIndex) [0x00035] in ./Library/PackageCache/com.unity.collections@9922678e06a0/Unity.Collections/UnsafeQueue.cs:186
at Unity.Collections.UnsafeQueue`1[T].Enqueue (T value) [0x00001] in ./Library/PackageCache/com.unity.collections@9922678e06a0/Unity.Collections/UnsafeQueue.cs:379
at Unity.Collections.NativeQueue`1[T].Enqueue (T value) [0x00008] in ./Library/PackageCache/com.unity.collections@9922678e06a0/Unity.Collections/NativeQueue.cs:98
at ParallelQueueJob.Execute (System.Int32 index) [0x00013] in /Users/armandas.dauzickas/Desktop/ReproProject_96077/Assets/Scripts/ParallelQueueJob.cs:21
at Unity.Jobs.IJobParallelForExtensions+ParallelForJobStruct`1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) [0x00031] in /Users/bokken/build/output/unity/unity/Runtime/Jobs/Managed/IJobParallelFor.cs:47
at (wrapper delegate-invoke) Unity.Jobs.IJobParallelForExtensions+ParallelForJobStruct`1+ExecuteJobFunction[ParallelQueueJob].invoke_void_T&_intptr_intptr_JobRanges&_int(ParallelQueueJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
(Filename: ./Library/PackageCache/com.unity.collections@9922678e06a0/Unity.Collections/UnsafeQueue.cs Line: 59)

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.