[Apex Hang] NAN hang in RenderScene.cpp after Apex-Debris-Timeout, at the moment the comp disappears from world

Dear Epic,

I spawn destructibles at runtime, and set the destructible mesh at runtime.

The destructible asset has a debris timeout of 7 seconds (APEX built-in Debris Time Out).

When the destructibles have been blown up and are about to time out of existence, I frequently get the ensure hang below.

It does not reference my own code anywhere and I disabled most of my own code.

Can you please investigate the order of events during the removal of debris-time-out apex pieces and the rest of UE4’s renderscene code?

It seems to me as though the apex piece is timing out while the renderscene is still trying to calculate its bounds, resulting in a NAN. The APEX timeout has to be intercepted/caught by the renderscene code so it doesnt try to calc the bounds of a component that is an APEX that has just timed out.

Ensure condition failed: !Primitive->Bounds.BoxExtent.ContainsNaN() && !Primitive->Bounds.Origin.ContainsNaN() && !FMath::IsNaN(Primitive->Bounds.SphereRadius) && FMath::IsFinite(Primitive->Bounds.SphereRadius) [File:D:\BuildFarm\buildmachine_++UE4+Release-4.11\Engine\Source\Runtime\Renderer\Private\RendererScene.cpp] [Line: 680]
Nans found on Bounds for Primitive Mesh: Origin X=0.000 Y=0.000 Z=0.000, BoxExtent X=-85070586659632214952926045871129231360.000 Y=-85070586659632214952926045871129231360.000 Z=-85070586659632214952926045871129231360.000, SphereRadius inf
Stack: 
UE4Editor-Core.dll!FWindowsPlatformStackWalk::StackWalkAndDump() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\windows\windowsplatformstackwalk.cpp:178]
UE4Editor-Core.dll!FDebug::EnsureFailed() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\misc\outputdevice.cpp:317]
UE4Editor-Core.dll!FDebug::OptionallyLogFormattedEnsureMessageReturningFalse() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\misc\outputdevice.cpp:441]
UE4Editor-Renderer.dll!FScene::UpdatePrimitiveTransform() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\renderer\private\rendererscene.cpp:679]
UE4Editor-Engine.dll!UPrimitiveComponent::SendRenderTransform_Concurrent() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\components\primitivecomponent.cpp:383]
UE4Editor-Engine.dll!UActorComponent::DoDeferredRenderUpdates_Concurrent() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\components\actorcomponent.cpp:1251]
UE4Editor-Engine.dll!<lambda_f9d3681dc5da55bd6bade4e18721b512>::operator()() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\engine\private\leveltick.cpp:836]
UE4Editor-Engine.dll!FParallelForData::Process() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\public\async\parallelfor.h:127]
UE4Editor-Engine.dll!TGraphTask<FParallelForTask>::ExecuteTask() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\public\async\taskgraphinterfaces.h:886]
UE4Editor-Core.dll!FTaskThreadAnyThread::ProcessTasks() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\async\taskgraph.cpp:1088]
UE4Editor-Core.dll!FTaskThreadAnyThread::ProcessTasksUntilQuit() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\async\taskgraph.cpp:982]
UE4Editor-Core.dll!FTaskThreadBase::Run() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\async\taskgraph.cpp:469]
UE4Editor-Core.dll!FRunnableThreadWin::Run() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:74]
UE4Editor-Core.dll!FRunnableThreadWin::GuardedRun() [d:\buildfarm\buildmachine_++ue4+release-4.11\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:31]
KERNEL32.DLL
ntdll.dll
ntdll.dll

#Setup

Here’s a pic for how to set up the debris timeout settings for APEX:

#Attempted Workaround

My first attempted work around was to add another component to the destructible actor, so that it would always have valid bounds, but the hang above still occurs because it is the destructible actor that is timing out that is throwing the error at the component level, due to having invalid bounds.

#Likely Solution
I think I have no choice but to use a custom engine build, or else do the time out myself instead of using the apex time out. (that would mean calling DestroyActor after a timed delay)

#:heart:

Rama

#Confirmed Workaround Solution

I am happy to report that manually destroying the APEX actor / destructible actor myself removes the NAN hang issue, but it is only a workaround because it means that the built in APEX timeout feature is not (currently) supported by UE4.

I dont recall having issues with APEX timeouts during the beta program but haven’t tested much since till now :slight_smile:

This also proves that it is an order-of-events timing issue within renderscene.cpp, who is still trying to calc the component bounds of an APEX component that has just timedout of existence, which then throws a NAN for the bounds.

#:heart:

Rama

Hi Rama,

This was originally reported with UE-28551. This has already been fixed in 4.12. I just tested in the 4.12 Preview 2 and it’s working properly without the ensure.

Thank you!

Tim

happy to hear this because it has been bugging me for some time now.

I can confirm that the fix in 4.12 is directly from git commit d3e100653305a3e4ca7763405cc477375157f3b5

I needed it for a project stuck in 4.11 for a bit and it does the charm. Thanks Tim for reporting it fixed.