Deadlock in GeomOverlapMulti_PhysX
We have been trying to get a helicopter up and working but myself and others are getting a deadlocking issue in the following file and function on the “PxI32 NumHits = SyncScene->overlapMultiple(…)” call:
D:\Unreal Engine\4.7\Engine\Source\Runtime\Engine\Private\Collision\PhysXCollision.cpp
#if WITH_PHYSX
bool GeomOverlapMulti_PhysX(const UWorld* World, const PxGeometry& PGeom, const PxTransform& PGeomPose, TArray<FOverlapResult>& OutOverlaps, ECollisionChannel TraceChannel, const struct FCollisionQueryParams& Params, const struct FCollisionResponseParams& ResponseParams, const struct FCollisionObjectQueryParams& ObjectParams)
{
SCOPE_CYCLE_COUNTER(STAT_Collision_GeomOverlapMultiple);
bool bHaveBlockingHit = false;
PxScene* LockedScenes[] = { nullptr, nullptr, nullptr };
// overlapMultiple only supports sphere/capsule/box
if (PGeom.getType()==PxGeometryType::eSPHERE || PGeom.getType()==PxGeometryType::eCAPSULE || PGeom.getType()==PxGeometryType::eBOX || PGeom.getType()==PxGeometryType::eCONVEXMESH )
{
// Create filter data used to filter collisions
PxFilterData PFilter = CreateQueryFilterData(TraceChannel, Params.bTraceComplex, ResponseParams.CollisionResponse, ObjectParams, true);
PxSceneQueryFilterData PQueryFilterData(PFilter, PxSceneQueryFilterFlag::eSTATIC | PxSceneQueryFilterFlag::eDYNAMIC | PxSceneQueryFilterFlag::ePREFILTER);
FPxQueryFilterCallback PQueryCallback(Params.IgnoreComponents);
// Enable scene locks, in case they are required
FPhysScene* PhysScene = World->GetPhysicsScene();
PxScene* SyncScene = PhysScene->GetPhysXScene(PST_Sync);
SCENE_LOCK_READ(SyncScene); //we can't use scoped because we later do a conversion which depends on these results and it should all be atomic
LockedScenes[PST_Sync] = SyncScene;
// Create buffer for hits. Note: memory is not initialized (for perf reasons), since API does not require it.
TTypeCompatibleBytes<PxOverlapHit> RawPOverlapArray[OVERLAP_BUFFER_SIZE];
PxOverlapHit* POverlapArray = (PxOverlapHit*)RawPOverlapArray;
PxI32 NumHits = SyncScene->overlapMultiple(PGeom, PGeomPose, POverlapArray, OVERLAP_BUFFER_SIZE_MAX_SYNC_QUERIES, PQueryFilterData, &PQueryCallback);
The last line is where it stops. The audio continues but the game and render threads seem to be stuck and the game freezes while in the editor.
Here is the complete stack trace and it is repeatable and occurs within a few minutes of our project.
PhysX3CommonPROFILE_x64.dll!000007fed378de9b() Unknown
PhysX3CommonPROFILE_x64.dll!000007fed378d519() Unknown
PhysX3CommonPROFILE_x64.dll!000007fed37289aa() Unknown
PhysX3CommonPROFILE_x64.dll!000007fed37c33c2() Unknown
PhysX3CommonPROFILE_x64.dll!000007fed385718d() Unknown
PhysX3CommonPROFILE_x64.dll!000007fed385a3d9() Unknown
PhysX3PROFILE_x64.dll!000007fed33d04a0() Unknown
PhysX3PROFILE_x64.dll!000007fed3590226() Unknown
PhysX3PROFILE_x64.dll!000007fed358dfd0() Unknown
PhysX3PROFILE_x64.dll!000007fed33cbd23() Unknown
UE4Editor-Engine.dll!GeomOverlapMulti_PhysX(const UWorld * World, const physx::PxGeometry & PGeom, const physx::PxTransform & PGeomPose, TArray<FOverlapResult,FDefaultAllocator> & OutOverlaps, ECollisionChannel TraceChannel, const FCollisionQueryParams & Params, const FCollisionResponseParams & ResponseParams, const FCollisionObjectQueryParams & ObjectParams) Line 1627 C++
UE4Editor-Engine.dll!FBodyInstance::OverlapMulti(TArray<FOverlapResult,FDefaultAllocator> & InOutOverlaps, const UWorld * World, const FTransform * pWorldToComponent, const FVector & Pos, const FRotator & Rot, ECollisionChannel TestChannel, const FComponentQueryParams & Params, const FCollisionResponseParams & ResponseParams, const FCollisionObjectQueryParams & ObjectQueryParams) Line 3721 C++
UE4Editor-Engine.dll!USkeletalMeshComponent::ComponentOverlapMulti(TArray<FOverlapResult,FDefaultAllocator> & OutOverlaps, const UWorld * World, const FVector & Pos, const FRotator & Rot, ECollisionChannel TestChannel, const FComponentQueryParams & Params, const FCollisionObjectQueryParams & ObjectQueryParams) Line 1886 C++
UE4Editor-Engine.dll!UWorld::ComponentOverlapMulti(TArray<FOverlapResult,FDefaultAllocator> & OutOverlaps, const UPrimitiveComponent * PrimComp, const FVector & Pos, const FRotator & Rot, const FComponentQueryParams & Params, const FCollisionObjectQueryParams & ObjectQueryParams) Line 401 C++
UE4Editor-Engine.dll!UPrimitiveComponent::UpdateOverlaps(const TArray<FOverlapInfo,FDefaultAllocator> * PendingOverlaps, bool bDoNotifies, const TArray<FOverlapInfo,FDefaultAllocator> * OverlapsAtEndLocation) Line 2256 C++
UE4Editor-Engine.dll!UPrimitiveComponent::MoveComponent(const FVector & Delta, const FRotator & NewRotation, bool bSweep, FHitResult * OutHit, EMoveComponentFlags MoveFlags) Line 1600 C++
UE4Editor-Engine.dll!UPrimitiveComponent::SyncComponentToRBPhysics() Line 557 C++
UE4Editor-Engine.dll!USkeletalMeshComponent::PreClothTick(float DeltaTime) Line 3087 C++
UE4Editor-Engine.dll!FTickTaskSequencer::FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 322 C++
UE4Editor-Engine.dll!TGraphTask<FTickTaskSequencer::FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 671 C++
UE4Editor-Core.dll!FTaskThread::ProcessTasks(int QueueIndex, bool bAllowStall) Line 428 C++
UE4Editor-Core.dll!FTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 271 C++
UE4Editor-Core.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,FDefaultAllocator> > & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 984 C++
UE4Editor-Engine.dll!FTaskGraphInterface::WaitUntilTaskCompletes(const TRefCountPtr<FGraphEvent> & Task, ENamedThreads::Type CurrentThreadIfKnown) Line 188 C++
UE4Editor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 187 C++
UE4Editor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 722 C++
UE4Editor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 696 C++
UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1126 C++
UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1329 C++
UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 347 C++
UE4Editor.exe!FEngineLoop::Tick() Line 2257 C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142 C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 191 C++
[External Code]
I have a sample project that I can provide (privately) to an Epic dev to investigate this issue as it has occurred every time within a few minutes of running this project.
Please e-mail me directly and I will send you the drop box link for the project.
Thanks!