Description

Sometimes some of actors are destroyed after the destruction of the solver through the garbage collector. In this case, the app crash in FChaosScene::RemoveActorFromAccelerationStructureImp because the FBodyInstance::TermBody return a dangling pointer of the physic scene (previously destroyed).

Ideally we would detect this case and report an error with the actor name so that the user can track down the problem asset.

Example callstack:

FChaosScene::RemoveActorFromAccelerationStructureImpFChaosScene::RemoveActorFromAccelerationStructure
FChaosEngineInterface::ReleaseActorFBodyInstance::TermBody
UPrimitiveComponent::OnDestroyPhysicsState
UStaticMeshComponent::OnDestroyPhysicsState
UActorComponent::DestroyPhysicsState
UActorComponent::ExecuteUnregisterEvents
UActorComponent::UnregisterComponent
AActor::UnregisterAllComponents
AActor::BeginDestroy
UObject::ConditionalBeginDestroy
UnhashUnreachableObjects
IncrementalPurgeGarbage
StaticExit
Invoke(UE::Core::Private::Tuple::TTupleBase<TIntegerSequence<unsigned int> >::ApplyAfter(TBaseStaticDelegateInstance<void (void),FDefaultDelegateUserPolicy>::ExecuteIfSafeTMulticastDelegateBase<FDefaultDelegateUserPolicy>::BroadcastTMulticastDelegate<void (void),FDefaultDelegateUserPolicy>::Broadcast
FEngineLoop::AppPreExitFEngineLoop::ExitEngineExit 
Steps to Reproduce

No known repro.

Rare cooker crashes during shutdown, possibly because an actor is being garbage collected and has not been unregistered. Crash is while attempting to unregister the body instance after the physics system has been shut down.

If this happens there is no useful log data to help track down the issue.

Desired: The cooker does not crash and instead reports some useful information about which Actors/Components are still registered when the solver is shut down.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-182925 in the post.

4
Login to Vote

Unresolved
ComponentUE - Simulation - Physics
Affects Versions5.1
Target Fix5.6
CreatedApr 11, 2023
UpdatedOct 25, 2024
View Jira Issue