Description

When an actor with geometry collection is destroyed,
the engine doesn't remove elements from array in the ChaosSolver
So illegal references occurs.

Removing element with following quick fix code can avoid crash on 4.25. (it doesn't work on 4.26)
However, this is probably not correct.

 

	bool FPBDRigidsSolver::UnregisterObject(FGeometryCollectionPhysicsProxy* InProxy)
	{
#if 1  // quick fix
		RemoveDirtyProxy(InProxy);
#endif  // quick fix
		InProxy->OnRemoveFromSolver(this);
		InProxy->SetSolver(static_cast<FPBDRigidsSolver*>(nullptr));
		return GeometryCollectionPhysicsProxies.Remove(InProxy) != 0;
	}

void FGeometryCollectionPhysicsProxy::OnRemoveFromSolver(Chaos::FPBDRigidsSolver *RBDSolver)
{
	const FGeometryDynamicCollection& DynamicCollection = PhysicsThreadCollection;

	for (const FClusterHandle* Handle : SolverClusterHandles)
	{
		RBDSolver->RemoveParticleToProxy(Handle);
	}
#if 1  // quick fix
	for (FClusterHandle* Handle : SolverParticleHandles)
	{
		RBDSolver->RemoveParticleToProxy(Handle);
		RBDSolver->GetEvolution()->DisableParticle(Handle);
	}
#endif  // quick fix
}
Steps to Reproduce

on 4.25

  1. # Open attached project on ue4.25  [Link Removed]
  2. start PIE
  3. Wait for 5 seconds
  4. Editor crashes

on 4.26

  1. Open attached project on ue4.25  [Link Removed] (Easier to reproduce with DebugEditor build )
  2. start PIE
  3. Wait for 5 seconds
  4. Approach the location where the geometry collection was located.
  5. Editor crashes
Callstack

> UE4Editor-PhysicsCore-Win64-Debug.dll!TSQVisitor<Chaos::TCapsule<float>,Chaos::TAccelerationStructureHandle<float,3>,ChaosInterface::FSweepHit>::Visit<1>(const Chaos::TSpatialVisitorData<Chaos::TAccelerationStructureHandle<float,3>> & Instance, Chaos::FQueryFastData * CurData) Line 224 C++ Symbols loaded.
UE4Editor-PhysicsCore-Win64-Debug.dll!TSQVisitor<Chaos::TCapsule<float>,Chaos::TAccelerationStructureHandle<float,3>,ChaosInterface::FSweepHit>::Sweep(const Chaos::TSpatialVisitorData<Chaos::TAccelerationStructureHandle<float,3>> & Instance, Chaos::FQueryFastData & CurData) Line 172 C++ Symbols loaded.
UE4Editor-Chaos-Win64-Debug.dll!Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TAABBTreeLeafArray<Chaos::TAccelerationStructureHandle<float,3>,float,1>,float,1>::QueryImp<1,Chaos::FQueryFastData,Chaos::TSpatialVisitor<Chaos::TAccelerationStructureHandle<float,3>,float>>(const Chaos::TVector<float,3> & Start, Chaos::FQueryFastData & CurData, const Chaos::TVector<float,3> QueryHalfExtents, const Chaos::TAABB<float,3> & QueryBounds, Chaos::TSpatialVisitor<Chaos::TAccelerationStructureHandle<float,3>,float> & Visitor) Line 738 C++ Symbols loaded.
UE4Editor-Chaos-Win64-Debug.dll!Chaos::TSpatialAccelerationCollectionHelper<0,3,Chaos::TSpatialTypeTuple<Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TAABBTreeLeafArray<Chaos::TAccelerationStructureHandle<float,3>,float,1>,float,1>,Chaos::TBoundingVolume<Chaos::TAccelerationStructureHandle<float,3>,float,3>,Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TBoundingVolume<Chaos::TAccelerationStructureHandle<float,3>,float,3>,float,1>>,Chaos::TAccelerationStructureHandle<float,3>,float,3>::SweepFast<Chaos::TSpatialVisitor<Chaos::TAccelerationStructureHandle<float,3>,float>>(const Chaos::TSpatialTypeTuple<Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TAABBTreeLeafArray<Chaos::TAccelerationStructureHandle<float,3>,float,1>,float,1>,Chaos::TBoundingVolume<Chaos::TAccelerationStructureHandle<float,3>,float,3>,Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TBoundingVolume<Chaos::TAccelerationStructureHandle<float,3>,float,3>,float,1>> & Types, const Chaos::TVector<float,3> & Start, Chaos::FQueryFastData & CurData, const Chaos::TVector<float,3> QueryHalfExtents, Chaos::TSpatialVisitor<Chaos::TAccelerationStructureHandle<float,3>,float> & Visitor) Line 210 C++ Symbols loaded.
UE4Editor-Chaos-Win64-Debug.dll!Chaos::TSpatialAccelerationCollection<Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TAABBTreeLeafArray<Chaos::TAccelerationStructureHandle<float,3>,float,1>,float,1>,Chaos::TBoundingVolume<Chaos::TAccelerationStructureHandle<float,3>,float,3>,Chaos::TAABBTree<Chaos::TAccelerationStructureHandle<float,3>,Chaos::TBoundingVolume<Chaos::TAccelerationStructureHandle<float,3>,float,3>,float,1>>::Sweep(const Chaos::TVector<float,3> & Start, const Chaos::TVector<float,3> & Dir, const float Length, const Chaos::TVector<float,3> QueryHalfExtents, Chaos::ISpatialVisitor<Chaos::TAccelerationStructureHandle<float,3>,float> & Visitor) Line 424 C++ Symbols loaded.
UE4Editor-PhysicsCore-Win64-Debug.dll!SweepHelper<Chaos::TCapsule<float>>(const Chaos::TCapsule<float> & QueryGeom, const Chaos::ISpatialAcceleration<Chaos::TAccelerationStructureHandle<float,3>,float,3> & SpatialAcceleration, const FTransform & StartTM, const FVector & Dir, const float DeltaMagnitude, ChaosInterface::FSQHitBuffer<ChaosInterface::FSweepHit> & HitBuffer, EHitFlags OutputFlags, const FChaosQueryFilterData & QueryFilterData, ICollisionQueryFilterCallbackBase & QueryCallback, const ChaosInterface::FQueryDebugParams & DebugParams) Line 546 C++ Symbols loaded.
UE4Editor-PhysicsCore-Win64-Debug.dll!<lambda_ff1c1c0d06ecbdc72e88f70be5874009>::operator()<Chaos::TCapsule<float>>(const Chaos::TCapsule<float> & Downcast, const FTransform & StartFullTM) Line 554 C++ Symbols loaded.
UE4Editor-PhysicsCore-Win64-Debug.dll!Chaos::Utilities::CastHelper<<lambda_ff1c1c0d06ecbdc72e88f70be5874009>>(const Chaos::FImplicitObject & Geom, const Chaos::TRigidTransform<float,3> & TM, const FChaosSQAccelerator::Sweep::__l2::<lambda_ff1c1c0d06ecbdc72e88f70be5874009> & Func) Line 26 C++ Symbols loaded.
UE4Editor-PhysicsCore-Win64-Debug.dll!FChaosSQAccelerator::Sweep(const Chaos::FImplicitObject & QueryGeom, const FTransform & StartTM, const FVector & Dir, const float DeltaMagnitude, ChaosInterface::FSQHitBuffer<ChaosInterface::FSweepHit> & HitBuffer, EHitFlags OutputFlags, const FChaosQueryFilterData & QueryFilterData, ICollisionQueryFilterCallbackBase & QueryCallback, const ChaosInterface::FQueryDebugParams & DebugParams) Line 555 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!LowLevelSweep(FPhysScene_Chaos & Scene, const Chaos::FImplicitObject & QueryGeom, const FTransform & StartTM, const FVector & Dir, float DeltaMag, ChaosInterface::FSQHitBuffer<ChaosInterface::FSweepHit> & HitBuffer, EHitFlags OutputFlags, FQueryFlags QueryFlags, const FCollisionFilterData & Filter, const FChaosQueryFilterData & QueryFilterData, ICollisionQueryFilterCallbackBase * QueryCallback, const ChaosInterface::FQueryDebugParams & DebugParams) Line 234 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!TSceneCastCommon<TSQTraits<ChaosInterface::FSweepHit,1,1>,FGeomCollectionSQAdditionalInputs>(const UWorld * World, TArray<FHitResult,TSizedDefaultAllocator<32>> & OutHits, const FGeomCollectionSQAdditionalInputs & GeomInputs, const FVector Start, const FVector End, ECollisionChannel TraceChannel, const FCollisionQueryParams & Params, const FCollisionResponseParams & ResponseParams, const FCollisionObjectQueryParams & ObjectParams) Line 365 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FGenericPhysicsInterface::GeomSweepMulti<FPhysicsGeometryCollection_Chaos>(const UWorld * World, const FPhysicsGeometryCollection_Chaos & InGeom, const FQuat & InGeomRot, TArray<FHitResult,TSizedDefaultAllocator<32>> & OutHits, FVector Start, FVector End, ECollisionChannel TraceChannel, const FCollisionQueryParams & Params, const FCollisionResponseParams & ResponseParams, const FCollisionObjectQueryParams & ObjectParams) Line 484 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UWorld::ComponentSweepMulti::__l2::<lambda>(Chaos::TGeometryParticle<float,3> * const & Actor) Line 439 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UE4Function_Private::TFunctionRefCaller<void <lambda>(Chaos::TGeometryParticle<float,3> * const &),void __cdecl(Chaos::TGeometryParticle<float,3> * const &)>::Call(void * Obj, Chaos::TGeometryParticle<float,3> * const & <Params_0>) Line 549 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FPhysInterface_Chaos::ExecuteRead(Chaos::TGeometryParticle<float,3> * const & InActorReference, TFunctionRef<void __cdecl(Chaos::TGeometryParticle<float,3> * const &)> InCallable) Line 668 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UWorld::ComponentSweepMulti(TArray<FHitResult,TSizedDefaultAllocator<32>> & OutHits, UPrimitiveComponent * PrimComp, const FVector & Start, const FVector & End, const FQuat & Quat, const FComponentQueryParams & Params) Line 447 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UPrimitiveComponent::MoveComponentImpl(const FVector & Delta, const FQuat & NewRotationQuat, bool bSweep, FHitResult * OutHit, EMoveComponentFlags MoveFlags, ETeleportType Teleport) Line 2182 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UMovementComponent::MoveUpdatedComponentImpl(const FVector & Delta, const FQuat & NewRotation, bool bSweep, FHitResult * OutHit, ETeleportType Teleport) Line 527 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UMovementComponent::SafeMoveUpdatedComponent(const FVector & Delta, const FQuat & NewRotation, bool bSweep, FHitResult & OutHit, ETeleportType Teleport) Line 569 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UCharacterMovementComponent::PhysFalling(float deltaTime, int Iterations) Line 4320 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UCharacterMovementComponent::StartNewPhysics(float deltaTime, int Iterations) Line 2906 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UCharacterMovementComponent::PerformMovement(float DeltaSeconds) Line 2407 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UCharacterMovementComponent::ControlledCharacterMove(const FVector & InputVector, float DeltaSeconds) Line 5574 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UCharacterMovementComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) Line 1352 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FActorComponentTickFunction::ExecuteTick::__l2::<lambda>(float DilatedTime) Line 1013 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FActorComponentTickFunction::ExecuteTickHelper<void <lambda>(float)>(UActorComponent * Target, bool bTickInEditor, float DeltaTime, ELevelTick TickType, const FActorComponentTickFunction::ExecuteTick::__l2::void <lambda>(float) & ExecuteTickFunc) Line 3573 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FActorComponentTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 1014 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 287 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread) Line 888 C++ Symbols loaded.
UE4Editor-Core-Win64-Debug.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 709 C++ Symbols loaded.
UE4Editor-Core-Win64-Debug.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 601 C++ Symbols loaded.
UE4Editor-Core-Win64-Debug.dll!FTaskGraphImplementation::ProcessThreadUntilRequestReturn(ENamedThreads::Type CurrentThread) Line 1474 C++ Symbols loaded.
UE4Editor-Core-Win64-Debug.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,TSizedDefaultAllocator<32>>> & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 1525 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 564 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 1578 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 782 C++ Symbols loaded.
UE4Editor-Engine-Win64-Debug.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1457 C++ Symbols loaded.
UE4Editor-UnrealEd-Win64-Debug.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1717 C++ Symbols loaded.
UE4Editor-UnrealEd-Win64-Debug.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 426 C++ Symbols loaded.
UE4Editor-Win64-Debug.exe!FEngineLoop::Tick() Line 4836 C++ Symbols loaded.
UE4Editor-Win64-Debug.exe!EngineTick() Line 63 C++ Symbols loaded.
UE4Editor-Win64-Debug.exe!GuardedMain(const wchar_t * CmdLine) Line 172 C++ Symbols loaded.
UE4Editor-Win64-Debug.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 257 C++ Symbols loaded.
[Inline Frame] UE4Editor-Win64-Debug.exe!invoke_main() Line 102 C++ Symbols loaded.
UE4Editor-Win64-Debug.exe!__scrt_common_main_seh() Line 288 C++ Symbols loaded.
kernel32.dll!00007ffd99d17034() Unknown No symbols loaded.
ntdll.dll!00007ffd9b1a2651() Unknown No symbols loaded.

Have Comments or More Details?

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

2
Login to Vote

Won't Fix
ComponentUE - Simulation - Physics
Affects Versions4.254.26
CreatedAug 7, 2020
ResolvedJul 19, 2022
UpdatedJul 19, 2022
View Jira Issue