UpdateNavMeshDataAsync: JobTempAlloc Lifespan of 4 frames / ScheduleJobForEach<BuildNavMeshInfo>

Hello, here on Unity 2022.2.1f, navigation package installed 1.1.1.

Recently I started getting this error, seems it doesn’t affect the editor (even if the error/warning is in the log) but in the Windows Build blocks the navmesh from being updated.

The line of code itself is just an UpdateNavMeshDataAsync, worked perfectly until recently and has not been changed in the past 6 months.
NavMeshBuilder.UpdateNavMeshDataAsync(…);

This is the error, I turned on some diagnostic to debug the leak.

Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 9)
Internal: JobTempAlloc has allocations that are more than the maximum lifespan of 4 frames old - this is not allowed and likely a leak
To Debug, run app with -diag-job-temp-memory-leak-validation cmd line argument. This will output the callstacks of the leaked allocations.
Allocation of 512 bytes at 4056c880 in block 1 (frameIndex=8, lifetime=4, age=4, state=OK)
0x00007ff79c5da422 (Unity) ujob_schedule_parallel_for_internal
0x00007ff79c5da2cc (Unity) ujob_schedule_parallel_for
0x00007ff79c5d7919 (Unity) JobQueue::ScheduleJobsForEach
0x00007ff79c5d632d (Unity) ScheduleJobForEachInternal
0x00007ff79cc8f208 (Unity) ScheduleJobForEach<BuildNavMeshInfo>
0x00007ff79cc93f1d (Unity) ClassifyTilesAndComputeMeshJob
0x00007ff79cc8e847 (Unity) AggregateJobCombineFunc<BuildNavMeshInfo>
0x00007ff79c5d99a8 (Unity) ujob_execute_job
0x00007ff79c5d9007 (Unity) lane_guts
0x00007ff79c5daeb4 (Unity) worker_thread_routine
0x00007ff79c7f2ff7 (Unity) Thread::RunThreadWrapper
0x00007ffa6c1e74b4 (KERNEL32) BaseThreadInitThunk
0x00007ffa6dda26a1 (ntdll) RtlUserThreadStart
01 00 00 00 07 00 00 00 02 00 00 00 00 00 00 00  ................
c0 c8 56 40 a4 02 00 00 a1 26 da 6d fa 7f 00 00  ..V@.....&.m....
00 00 00 00 00 00 00 00 00 00 00 00 43 22 fd 3f  ............C".?
46 5f 2c bf e7 d5 12 bf 00 00 00 00 06 3f b1 3f  F_,..........?.?
02 00 00 00 02 00 00 00 09 00 00 00 00 00 00 00  ................
00 c9 56 40 a4 02 00 00 c8 d2 ad 3f 00 00 00 00  ..V@.......?....
00 00 00 00 00 00 00 00 00 00 00 00 43 22 fd 3f  ............C".?
46 5f 2c bf e7 d5 12 bf 00 00 00 00 06 3f b1 3f  F_,..........?.?
Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 11)
Processing queue in navmesh left are : 2 blockall is: False
UnityEngine.StackTraceUtility:ExtractStackTrace ()
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:Log (object)
LocalNavMeshBuilder:smile:one (UnityEngine.AsyncOperation) (at Assets/LocalNavMeshBuilder.cs:177)
LocalNavMeshBuilder:Update_AsynchMode (System.ValueTuple`2<UnityEngine.Bounds, NavMesh_Target>) (at Assets/LocalNavMeshBuilder.cs:169)
3 Likes

Wondering if this is also related to:
UnityEngine.StackTraceUtility:ExtractStackTrace ()

But also:
0x00007ff79cc8e847 (Unity) AggregateJobCombineFunc

Did you find a fix for this?

is there a bug report for this BTW?

Hi, sorry for the late answer, at the end the error wasn’t really affecting the navmesh.
I guess it is something internal related to the job system / internal task checks… but since no one from unity is replying I stopped paying attention to it.

My project seems to be unaffected at the moment.

There are two problems with this:

  • It’s spamming into log file
  • If other similar issue appears, we won’t know about it
    (we will think it’s NavMesh, until we run the game with leak detection)

So could we please fix this somehow?
I’d be okay with per-project setting: FrameCount when JobTempAlloc is considered leak, I’d just put something like 20 and it would be resolved.

I seem to be having this issue as well, and I can confirm that it happens when I call an update on the navmesh surface. It only seems to be happening on some specific scenes, and I haven’t figured out why yet. But is 100% in one of the scenes.

...
myNavmeshSurface.UpdateNavMesh(myNavmeshSurface.navMeshData);```

I have not yet updated to the never navmesh system. Could that be the reason?
Using Unity 2022.3.0f1 - AI Navigation 1.1.3.

Also have same exact issue with UpdateNavMeshDataAsync
I basicly took it from one of the unity git with nav components examples project

AI Navigation package version 1.1.4

I have the same issue, would be great if anyone has a solution for this.

For the 1.1.4 I guess it is handled by the garbage collector, so its not breaking when compiled but its creating garbage most possibly

Until someone from Unity replies, I would consider a custom solution, because at least if it bugs somewhere I could intervene and fix it. With the unity package I cant do anything.

Btw the AI Navigation has a version of 2.0 in Unity 2023, but I havent tried it

Did anyone file a bug report about this? If so can you share the bug ID with me?

1 Like

Thanks for coming in, I havent made a bug report.

I think you can dublicate it 100% from the git sample project of AI Navigation, at the example with the Mesh Deformation, where it uses the async baking.

Could you see over it or a bug report is needed aswell?

I think I reproduced it - without a repro from you I can’t guarantee that what I’ve seen is your issue exactly, but I think it’s likely. A fix is already en route to 2022.3.8, 2023.1.9, 2023.2.0b5, and 2023.3.0a1.

1 Like