runtime navmesh generation crashes in 5.5

I have my project configured to generate navmeshes dynamically at runtime. Once I upgraded to 5.5, I started experiencing crashes with this callstack:

>	[Inline Frame] UnrealEditor-NavigationSystem.dll!FNavigationElement::GetWeakUObject() Line 374	C++
 	UnrealEditor-NavigationSystem.dll!FRecastTileGenerator::AddReferencedObjects(FReferenceCollector & Collector) Line 4832	C++
 	UnrealEditor-CoreUObject.dll!UGCObjectReferencer::AddReferencedObjects(UObject * InThis, FReferenceCollector & Collector) Line 69	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::Private::CallARO(UE::GC::TBatchDispatcher<UE::GC::TReachabilityProcessor<5>> & Word, UObject *) Line 597	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::Private::VisitMembers(UE::GC::TBatchDispatcher<UE::GC::TReachabilityProcessor<5>> &) Line 689	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::TFastReferenceCollector<UE::GC::TReachabilityProcessor<5>,UE::GC::TReachabilityCollector<5>>::ProcessObjects(UE::GC::TBatchDispatcher<UE::GC::TReachabilityProcessor<5>> &) Line 982	C++
 	UnrealEditor-CoreUObject.dll!UE::GC::TFastReferenceCollector<UE::GC::TReachabilityProcessor<5>,UE::GC::TReachabilityCollector<5>>::ProcessObjectArray(UE::GC::FWorkerContext & Context) Line 893	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::FRealtimeGC::CollectReferencesForGC::__l3::<lambda_1>::operator()(void *) Line 3941	C++
 	UnrealEditor-CoreUObject.dll!?<lambda_invoker_cdecl>@<lambda_1>@?2???$CollectReferencesForGC@V?$TReachabilityCollector@$04@GC@UE@@V?$TReachabilityProcessor@$04@23@@FRealtimeGC@GC@UE@@AEAAXAEAV?$TReachabilityProcessor@$04@34@AEAUFWorkerContext@34@@Z@SA@PEAX1@Z(void * P, UE::GC::FWorkerContext & C) Line 3941	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::ProcessAsync::__l8::<lambda_1>::operator()() Line 6976	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!Invoke(UE::GC::ProcessAsync::__l8::<lambda_1> &) Line 47	C++
 	UnrealEditor-CoreUObject.dll!?ExecuteTask@?$TExecutableTaskBase@V<lambda_1>@?7??ProcessAsync@GC@UE@@YAXP6AXPEAXAEAUFWorkerContext@34@@Z01@Z@XX@Private@Tasks@UE@@UEAAXXZ() Line 873	C++
 	UnrealEditor-CoreUObject.dll!UE::Tasks::Private::FTaskBase::TryExecuteTask() Line 504	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::Tasks::Private::FTaskBase::Init::__l2::<lambda_1>::operator()() Line 185	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!LowLevelTasks::FTask::Init::__l13::<lambda_1>::operator()(const bool) Line 499	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!Invoke(LowLevelTasks::FTask::Init::__l13::<lambda_1> &) Line 47	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1>>'::`13'::<lambda_1>,0>::Call(void *) Line 162	C++
 	UnrealEditor-CoreUObject.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::TTaskDelegateImpl<`LowLevelTasks::FTask::Init<`UE::Tasks::Private::FTaskBase::Init'::`2'::<lambda_1>>'::`13'::<lambda_1>,0>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> & Destination, void * InlineData, unsigned int DestInlineSize, bool <Params_0>) Line 171	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48>::CallAndMove(LowLevelTasks::TTaskDelegate<LowLevelTasks::FTask * __cdecl(bool),48> &) Line 308	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FTask::ExecuteTask() Line 627	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::ExecuteTask(LowLevelTasks::FTask * InTask) Line 245	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::TryExecuteTaskFrom(LowLevelTasks::Private::FWaitEvent *) Line 457	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerLoop(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 514	C++
 	[Inline Frame] UnrealEditor-Core.dll!LowLevelTasks::FScheduler::WorkerMain(LowLevelTasks::Private::FWaitEvent * WorkerEvent, LowLevelTasks::Private::TLocalQueueRegistry<1024,1024>::TLocalQueue * WorkerLocalQueue, unsigned int WaitCycles, bool bPermitBackgroundWork) Line 571	C++
 	UnrealEditor-Core.dll!LowLevelTasks::FScheduler::CreateWorker::__l2::<lambda>() Line 75	C++
 	[Inline Frame] UnrealEditor-Core.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 470	C++
 	UnrealEditor-Core.dll!FThreadImpl::Run() Line 69	C++
 	UnrealEditor-Core.dll!FRunnableThreadWin::Run() Line 159	C++
 	UnrealEditor-Core.dll!FRunnableThreadWin::GuardedRun() Line 71	C++
 	kernel32.dll!00007ff88b8b7374()	Unknown
 	ntdll.dll!RtlUserThreadStart()	Unknown

The issue stems from this check that was added into the nav mesh code: https://github.com/EpicGames/UnrealEngine/blob/release/Engine/Source/Runtime/Engine/Classes/AI/Navigation/NavigationElement.h#L374

During GC, the AddReferencedObjects function gets called here in FRecastTileGenerator and if there’s data in NavigationRelevantData, it will call GetWeakUObject on the SourceElement. If the GC is running in parallel mode, it is possible that it will not run on the main thread and this check() causes a crash.

This seems like a bug within the engine unless runtime navmesh generation is no longer supported? Is this a known issue? We are using the workaround of ‘Allow Parallel GC’ to be false, but that doesn’t seem like a shippable solution.

1 Like

I get this crash as well. My project depends on runtime generation so it will be extremely disappointing if this is no longer supported.

1 Like