PhysX Crash During Destructible Mesh Creation

Hey guys,

Currently working on a project that involves building a lot of structures from hierarchical instanced static mesh components. We want these buildings to be destructible, so I’ve attached a component to player character that, on tick, does an OverlapMultiByObjectType, gathers all HISMCs in a radius around them, and replaces them with destructible mesh components.

After a certain number of conversions, engine crashes. number of conversions required varies based on settings (see below callstack for details).

engine is crashing with this callstack:

MachineId:2A2D385F4FB910D788020B9754E0EE1F
EpicAccountId:72c1df1e45e54b6eb8d495162d6ae7d2

Access violation - code c0000005 (first/second chance not available)

""

APEX_DestructiblePROFILE_x64
APEX_DestructiblePROFILE_x64
APEX_DestructiblePROFILE_x64
APEXFrameworkPROFILE_x64
UE4Editor_Engine!TGraphTask<FPhysXTask>::ExecuteTask() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\public\async\taskgraphinterfaces.h:779]
UE4Editor_Core!FTaskThread::ProcessTasks() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\async\taskgraph.cpp:539]
UE4Editor_Core!FTaskThread::ProcessTasksUntilQuit() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\async\taskgraph.cpp:340]
UE4Editor_Core!FTaskThread::Run() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\async\taskgraph.cpp:690]
UE4Editor_Core!FRunnableThreadWin::Run() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.10\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:74]

I’m having serious trouble tracking this one down, and it’s getting very frustrating. I have discovered two things:

  1. Disabling “Form Extended Structures” on destructible mesh significantly reduces frequency of crashes (with it enabled, it crashes within first 5-10 HISMC conversions. With it disabled, it can take from 13000 - 20000 conversions to do it). Note that having “Form Extended Structures” enabled also significantly reduces project’s performance/FPS, so perhaps physics processing time has a connection.

  2. Enabling async scene slightly reduces crash frequency (instead of 5-10 conversions, about 150 - 200).

  3. Commenting out destructible mesh spawning code, but leaving HISMC removal code in, causes crash to stop occuring. other way around, however, does not. So it’s connected to destructible mesh spawning, not HISMC removal.

I could really use some help on this. I can’t have a crash like this lingering around in my project, and it’s starting to feel impossible to debug on my own. Spent about 8-10 hours on it so far, fiddling with everything I could think of.

Thanks in advance!

Hi Beowulfe,

Thanks for details! This is a known crash that we have reported as UE-22078. It appears to be a PhysX crash when spawning Instanced Static Meshes at runtime. A fix has been created in our internal dev branches but it’s not ready to integrate into main branch quite yet. developers are still hoping to get it fixed for 4.11. I’ll update post with your notes and let you know if I see any update on it. Thanks again!

Great, thanks, keep me updated. Really hoping this makes it into 4.11, as it’s a key component to our project.

Just to double check one thing - You mentioned it was a crash caused by spawning ISMs at runtime. As far as I can tell, with my crash, I can spawn and remove any number of ISMs without any issues. It’s when I start spawning destructible mesh components in their place that issue occurs.

I can see that still being related, but I wanted to double check there wasn’t a second underlying issue at play.

devs believe it’s a crash in destruction, something about a null entry in a deleted pair that isn’t supposed to be null, so it may have more to do with replacing ISMs with Destructible Meshes than simply spawning ISMs or Destructibles. Regardless, it’s going to be difficult to be sure until this fix is integrated. If you’re building from source, I can find GitHub commit once it’s released so you can try it, otherwise I’ll figure out which Preview build it would make it to and let you know.

I’m not currently building from source, but I do have GitHub engine files downloaded, so I can give it a shot once commit goes live. If you get a chance to pass me commit info once it up, that’d be great. I’ll keep my eye on 4.11 preview changes as well. Thanks. :slight_smile:

Hey, curious if this has this been resolved in 4.11 patch…

Hello,

This issue has been reported fixed in 4.11. If you are still seeing issue occur in 4.11, please let us know.

Have a great day

Awesome, thanks Sean!