x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[Closed] [4.11] PhysX component-related crash

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 <lambda>(physx::PxShape *) >(FBodyInstance * BodyInstance, physx::PxShape * PShape, FBodyInstance::ApplyMaterialToInstanceShapes_AssumesLocked::__l4::void <lambda>(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::remove<physx::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 !

Product Version: UE 4.11 Preview
Tags:
more ▼

asked Mar 10 '16 at 07:26 AM in Bug Reports

avatar image

StrangerGwenn
604 55 64 133

avatar image Niavok Mar 10 '16 at 10:15 AM

I have the same problem with 4.11 HEAD on linux.

avatar image Doug E ♦♦ STAFF Mar 10 '16 at 07:26 PM

Hey Gwenn-

Can you provide the log files from the crash as well. If possible, could you send a copy of the failing project? This can be done by either zipping the project and posting here or uploading it to DropBox or google drive and send me a PM on the forums with a download link for privacy.

So far I have tested SetStaticMesh and SetMaterial, both of which I was able to open the project and PIE after adding the code to a custom class. In case DestroyPhysicsState is part of the issue I would like to make sure my setup matches what you're doing as closely as possible.

Cheers

Doug Wilson

avatar image StrangerGwenn Mar 14 '16 at 11:07 AM

Hi Doug,

I'm sending you the project files.

avatar image Doug E ♦♦ STAFF Mar 14 '16 at 05:12 PM

Hey Gwenn-

I got the project you sent and after debugging in Visual Studio it appears that the crash consistently occurs in FlareSpacecraftComponent.cpp at line 165 (FLOGV("LOD %d APPLY EffectMaterial %s", LODIndex,*EffectMaterial->GetName());). Further, I realized that the crash occurs when EffectMaterial is equal to "MaterialInstanceDynamic"_34. I say this because it appears to run through this function multiple times with EffectMaterial having a different value each time (first _30, then _32, then crash at _34). The issue seems to be with whatever this value represents, however I can't dig further as I am not sure where this value is coming from.

avatar image StrangerGwenn Mar 14 '16 at 05:31 PM

This is consistent with what we're seeing.

The behavior you described is expected. This function creates two material instances for each mesh, and applies it to every LOD section. What we're trying to understand is why SetMaterial() crashes.

Trouble is, the crash occurs inside PhysX, and we have no idea what is supposed to happen inside that - I don't believe the source is available for that particular part of UE4. You should have roughly the same call stack as quoted above (physx::shdfnd::atomicDecrement etc).

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

The question has been closed May 31 '17 at 07:34 PM by StrangerGwenn for the following reason:

The question is answered, right answer was accepted


1 answer: sort voted first

Hey Gwenn-

The callstack I received did not mention physx::shdfnd::atomicDecrement, however after testing again on Linux I did receive the same error. This issue may be specific to Linux and I have entered a bug report (UE-28399) for further investigation.

Cheers

Doug Wilson

more ▼

answered Mar 14 '16 at 07:39 PM

avatar image StrangerGwenn Mar 14 '16 at 08:01 PM

Thanks !

It's strange because I'm having this issue in a very reproducible fashion, both in source and binary releases of 4.11 P7 on Windows, and Linux source. We tested those three versions and we're getting very consistent results. On Windows, in debug builds, we're always getting the crash inside PhysX3PROFILE_x64.dll.

avatar image StrangerGwenn Mar 28 '16 at 08:07 AM

Any news ?

avatar image Doug E ♦♦ STAFF Mar 28 '16 at 01:07 PM

The crash that was occurring when SetMaterial was called has been addressed internally and should be fixed in the final 4.11 release.

avatar image StrangerGwenn Mar 28 '16 at 01:09 PM

Thank you so much !

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question