RVO/ClampToNavmesh related crash

A* version 4.3.60
Unity version 2021.3.4f1
Recast graph with richAI components, overlapping NavMeshAdds.

I’ve been encountering a crash in my game and was unsure what was causing it but just now unity managed to recover from one after a few minutes and spat out a few errors, the first of which seems to involve RVOObstacleCache.getObstaclesAround and RichAI.ClampToNavmesh.

I’m not sure how reproducible it is as it happens kind of randomly.

System.InvalidOperationException: Attempted to operate on {size} bytes of memory: nonsensical
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffd3adee669 (4ba10e8559e59584b356e073ac93bee) [AllocatorManager.cs:37] Unity.Collections.AllocatorManager.AllocateBlock<Unity.Collections.AllocatorManager.AllocatorHandle>
0x00007ffd3adeed0e (4ba10e8559e59584b356e073ac93bee) [UnsafeList.cs:410] Unity.Collections.LowLevel.Unsafe.UnsafeList1<Unity.Mathematics.float3>::Unity.Collections.LowLevel.Unsafe.UnsafeList1<Unity.Mathematics.float3>.SetCapacity<Unity.Collections.AllocatorManager.AllocatorHandle>
0x00007ffd3adec892 (4ba10e8559e59584b356e073ac93bee) [unknown:0] Unity.Jobs.IJobExtensions.JobStruct1<Pathfinding.RVO.RVOObstacleCache.TraceContoursJob>.Execute 0x00007ffd3adeb771 (4ba10e8559e59584b356e073ac93bee) cf3eb5f02b57c471bee28d35a03418bb 0x00007ff777486cc0 (Unity) ExecuteJob 0x00007ff777487d4f (Unity) ForwardJobToManaged 0x00007ff777488ca6 (Unity) ScheduleManagedJob 0x00007ff7769f794a (Unity) JobsUtility_CUSTOM_Schedule_Injected 0x000002d42467554c (Mono JIT Code) (wrapper managed-to-native) Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule_Injected (Unity.Jobs.LowLevel.Unsafe.JobsUtility/JobScheduleParameters&,Unity.Jobs.JobHandle&) 0x000002d42467537b (Mono JIT Code) Unity.Jobs.LowLevel.Unsafe.JobsUtility:Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility/JobScheduleParameters&) 0x000002d42bef85bb (Mono JIT Code) Unity.Jobs.IJobExtensions:Run<Pathfinding.RVO.RVOObstacleCache/TraceContoursJob> (Pathfinding.RVO.RVOObstacleCache/TraceContoursJob) 0x000002d424653a4b (Mono JIT Code) [RVOObstacleCache.cs:209] Pathfinding.RVO.RVOObstacleCache:GetObstaclesAround (Pathfinding.GraphNode,int,Pathfinding.Util.SimpleMovementPlane,Pathfinding.RVO.SimulatorBurst/ObstacleData&) 0x000002d424650163 (Mono JIT Code) [RVOCoreSimulatorBurst.cs:540] Pathfinding.RVO.SimulatorBurst/Agent:SetObstacleQuery (Pathfinding.GraphNode,int,Pathfinding.Util.SimpleMovementPlane) 0x000002d42464ef3b (Mono JIT Code) [RichAI.cs:525] Pathfinding.RichAI:ClampToNavmesh (UnityEngine.Vector3,bool&) 0x000002d42464ce17 (Mono JIT Code) [AIBase.cs:791] Pathfinding.AIBase:FinalizePosition (UnityEngine.Vector3) 0x000002d42464ba43 (Mono JIT Code) [AIBase.cs:752] Pathfinding.AIBase:FinalizeMovement (UnityEngine.Vector3,UnityEngine.Quaternion) 0x000002d424640cb7 (Mono JIT Code) [AIBase.cs:497] Pathfinding.AIBase:OnUpdate (single) 0x000002d42463a7a9 (Mono JIT Code) [AIBase.cs:477] Pathfinding.AIBase:OnUpdate (Pathfinding.AIBase[],int,Pathfinding.Util.BatchedEvents/Event) 0x000002d424639284 (Mono JIT Code) [BatchedEvents.cs:150] Pathfinding.Util.BatchedEvents/<>c__DisplayClass14_01<T_REF>:b__0 (object[],int,Pathfinding.Util.BatchedEvents/Event)
0x000002d4245fbaaa (Mono JIT Code) [BatchedEvents.cs:172] Pathfinding.Util.BatchedEvents:DoEvent (Pathfinding.Util.BatchedEvents/Event)
0x000002d42463916b (Mono JIT Code) [BatchedEvents.cs:192] Pathfinding.Util.BatchedEvents:FixedUpdate ()
0x000002d43337a7b8 (Mono JIT Code) (wrapper runtime-invoke) object:runtime_invoke_void__this__ (object,intptr,intptr,intptr)
0x00007ffce646e334 (mono-2.0-bdwgc) [mini-runtime.c:3445] mono_jit_runtime_invoke
0x00007ffce63ae764 (mono-2.0-bdwgc) [object.c:3066] do_runtime_invoke
0x00007ffce63ae8fc (mono-2.0-bdwgc) [object.c:3113] mono_runtime_invoke
0x00007ff7778155b4 (Unity) scripting_method_invoke
0x00007ff7778101d4 (Unity) ScriptingInvocation::Invoke
0x00007ff7777dde44 (Unity) MonoBehaviour::CallMethodIfAvailable
0x00007ff7777ddf4c (Unity) MonoBehaviour::CallUpdateMethod
0x00007ff7772d5b48 (Unity) BaseBehaviourManager::CommonUpdate
0x00007ff7772dd18a (Unity) FixedBehaviourManager::Update
0x00007ff7774ecd46 (Unity) InitPlayerLoopCallbacks'::2’::FixedUpdateScriptRunBehaviourFixedUpdateRegistrator::Forward
0x00007ff7774d437c (Unity) ExecutePlayerLoop
0x00007ff7774d4453 (Unity) ExecutePlayerLoop
0x00007ff7774da099 (Unity) PlayerLoop
0x00007ff778420d78 (Unity) PlayerLoopController::UpdateScene
0x00007ff77841ef5f (Unity) Application::TickTimer
0x00007ff77886aa4a (Unity) MainMessageLoop
0x00007ff77886f2fb (Unity) WinMain
0x00007ff779ba18ee (Unity) __scrt_common_main_seh
0x00007ffd561b7034 (KERNEL32) BaseThreadInitThunk
0x00007ffd56b226a1 (ntdll) RtlUserThreadStart

Exception: Trying to free an already freed index
Pathfinding.Util.SlabAllocator`1[T].Free (System.Int32 allocatedIndex) (at Library/PackageCache/com.arongranberg.astar@4.3.60/Utilities/SlabAllocator.cs:187)
Pathfinding.RVO.RVOObstacleCache.FreeUnusedObstacles (Pathfinding.RVO.SimulatorBurst+AgentData& agentData, Pathfinding.RVO.SimulatorBurst+ObstacleData& obstacleData, System.Int32 numAgents) (at Library/PackageCache/com.arongranberg.astar@4.3.60/Core/RVO/RVOObstacleCache.cs:56)
Pathfinding.RVO.SimulatorBurst.UpdateInternal[T] () (at Library/PackageCache/com.arongranberg.astar@4.3.60/Core/RVO/RVOCoreSimulatorBurst.cs:1119)
Pathfinding.RVO.SimulatorBurst.Update () (at Library/PackageCache/com.arongranberg.astar@4.3.60/Core/RVO/RVOCoreSimulatorBurst.cs:1074)
Pathfinding.RVO.RVOSimulator.Update () (at Library/PackageCache/com.arongranberg.astar@4.3.60/RVO/RVOSimulator.cs:137)

System.Exception: Trying to get a span for an unallocated index
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffcf20417fd (4c3f269672086dbbf8e722f5a1140d6) [RVOAgentBurst.cs:1146] Pathfinding.RVO.Sampled.JobRVO1<Pathfinding.RVO.XZMovementPlane>::Pathfinding.RVO.Sampled.JobRVO1<Pathfinding.RVO.XZMovementPlane>.GenerateObstacleVOs
0x00007ffcf203ca88 (4c3f269672086dbbf8e722f5a1140d6) [RVOAgentBurst.cs:1263] Pathfinding.RVO.Sampled.JobRVO1<Pathfinding.RVO.XZMovementPlane>::Pathfinding.RVO.Sampled.JobRVO1<Pathfinding.RVO.XZMovementPlane>.ExecuteORCA
0x00007ffcf203b20a (4c3f269672086dbbf8e722f5a1140d6) [IJobParallelForBatched.cs:35] Pathfinding.Jobs.JobParallelForBatchedExtensions.ParallelForBatchJobStruct1<Pathfinding.RVO.Sampled.JobRVO1<Pathfinding.RVO.XZMovementPlane>>.Execute
0x00007ffcf203abe1 (4c3f269672086dbbf8e722f5a1140d6) 906909cd62835d28eb9a35bbf6591c6e
0x00007ff777486cc0 (Unity) ExecuteJob
0x00007ff777486f75 (Unity) ExecuteJobCopyData
0x00007ff777487bcf (Unity) ForwardJobForEachToManaged
0x00007ff77748319c (Unity) JobQueue::Exec
0x00007ff77748345a (Unity) JobQueue::ExecuteJobFromHighPriorityStack
0x00007ff7774839e9 (Unity) JobQueue::ProcessJobs
0x00007ff777485a4f (Unity) JobQueue::WorkLoop
0x00007ff77767dd07 (Unity) Thread::RunThreadWrapper
0x00007ffd561b7034 (KERNEL32) BaseThreadInitThunk
0x00007ffd56b226a1 (ntdll) RtlUserThreadStart

Hi

Try to upgrade to the latest beta. I think it had been fixed there

1 Like