Hi there,
I’ve been tracking a painful crash for two days, since Preview 7 came out. Basically our game always crash at launch on the 4.11 branch but we have no idea what causes it. Things than can cause it include :
- UStaticMeshComponent::SetStaticMesh
- UStaticMeshComponent::SetMaterial
- UPrimitiveComponent::DestroyPhysicsState (when exiting)
We’re probably doing something wrong (the game creates, moves, attaches a lot of components) but the issue is new from Preview 7, and it feels like the crash is too low level. The UE4 state looks fine - we’re not calling these on NULL or 0xcdcdcdcd, but on valid, existing and sane objects. We’ve checked that. We’re also pretty sure we didn’t change anything related to this part of our code base for months.
Here are typical call stacks for this issue. When using SetMaterial
PhysX3CommonPROFILE_x64.dll!physx::shdfnd::atomicDecrement(volatile int * val) Line 45 C++
PhysX3PROFILE_x64.dll!physx::NpShape::setMaterials(physx::PxMaterial * const * materials, unsigned short materialCount) Line 498 C++
UE4Editor-Engine.dll!FBodyInstance::ApplyMaterialToShape_AssumesLocked(physx::PxShape * PShape, physx::PxMaterial * PSimpleMat, const TArray<UPhysicalMaterial *,FDefaultAllocator> & ComplexPhysMats, const bool bSharedShape) Line 4559 C++
UE4Editor-Engine.dll!ExecuteOnPxShapeWrite<void (physx::PxShape *) >(FBodyInstance * BodyInstance, physx::PxShape * PShape, FBodyInstance::ApplyMaterialToInstanceShapes_AssumesLocked::__l4::void (physx::PxShape *) Func) Line 700 C++
UE4Editor-Engine.dll!FBodyInstance::ApplyMaterialToInstanceShapes_AssumesLocked(physx::PxMaterial * PSimpleMat, TArray<UPhysicalMaterial *,FDefaultAllocator> & ComplexPhysMats) Line 4570 C++
UE4Editor-Engine.dll!FBodyInstance::ExecuteOnPhysicsReadWrite(TFunctionRef<void __cdecl(void)> Func) Line 2984 C++
UE4Editor-Engine.dll!FBodyInstance::UpdatePhysicalMaterials() Line 421 C++
UE4Editor-Engine.dll!UMeshComponent::SetMaterial(int ElementIndex, UMaterialInterface * Material) Line 72 C++
When exiting the game
PhysX3CommonPROFILE_x64.dll!physx::shdfnd::atomicDecrement(volatile int * val) Line 45 C++
PhysX3PROFILE_x64.dll!physx::NpShape::~NpShape() Line 53 C++
[External Code]
PhysX3PROFILE_x64.dll!physx::NpFactory::releaseShapeToPool(physx::NpShape & shape) Line 874 C++
PhysX3PROFILE_x64.dll!physx::NpDestroy(physx::Scb::Base & base) Line 1249 C++
PhysX3PROFILE_x64.dll!physx::Scb::Scene::removephysx::Scb::Body,1(physx::Scb::Body & v, physx::Scb::ObjectTracker & tracker, bool wakeOnLostTouch) Line 411 C++
PhysX3PROFILE_x64.dll!physx::Scb::Scene::removeRigidBody(physx::Scb::Body & body, bool wakeOnLostTouch, bool noSim) Line 601 C++
PhysX3PROFILE_x64.dll!physx::NpRigidDynamic::release() Line 66 C++
UE4Editor-Engine.dll!TermBodyHelper(short & SceneIndex, physx::PxRigidActor * & PRigidActor, FBodyInstance * BodyInstance) Line 1847 C++
UE4Editor-Engine.dll!FBodyInstance::TermBody() Line 1900 C++
UE4Editor-Engine.dll!UPrimitiveComponent::DestroyPhysicsState() Line 574 C++
UE4Editor-Engine.dll!UActorComponent::ExecuteUnregisterEvents() Line 1120 C++
UE4Editor-Engine.dll!UActorComponent::UnregisterComponent() Line 945 C++
UE4Editor-Engine.dll!AActor::UnregisterAllComponents() Line 3737 C++
UE4Editor-Engine.dll!ULevel::ClearLevelComponents() Line 659 C++
UE4Editor-Engine.dll!UWorld::ClearWorldComponents() Line 1268 C++
UE4Editor-Engine.dll!UWorld::CleanupWorld(bool bSessionEnded, bool bCleanupResources, UWorld * NewWorld) Line 3225 C++
UE4Editor-UnrealEd.dll!UEditorEngine::TeardownPlaySession(FWorldContext & PieWorldContext) Line 653 C++
UE4Editor-UnrealEd.dll!UEditorEngine::EndPlayMap() Line 255 C++
Reproduces on
- 4.11 Preview 7 both on source or binary
- 4.11 head (58e0a2044ee5952a7dcd895ba53e889d6903d5dc as of now)
Doesn’t reproduce on
- 4.11 Preview 6 both on source or binary
- promoted head (bf634d600724c835dfac4c0b3f807480f072d292 as of now)
Sorry about the lack of details. We’ve been unable to track down what causes the crash.
Thanks !