FStaticMeshInstanceBuffer Crash on PIE

I updated from UE 4.16.1 to UE 4.17.

Often, when I try to start playing in the editor, I get a crash regarding the FStaticMeshInstanceBuffer. This is the Crash report:

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

UE4Editor_Engine!FStaticMeshInstanceBuffer::UpdateInstanceData() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\engine\private\instancedstaticmesh.cpp:137]
UE4Editor_Engine!FPerInstanceRenderData::UpdateInstanceData() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\engine\private\instancedstaticmesh.h:431]
UE4Editor_Engine!UInstancedStaticMeshComponent::PostDuplicate() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\engine\private\instancedstaticmesh.cpp:2052]
UE4Editor_CoreUObject!StaticDuplicateObjectEx() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:2060]
UE4Editor_CoreUObject!StaticDuplicateObject() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:1917]
UE4Editor_UnrealEd!UEditorEngine::CreatePIEWorldByDuplication() [d:\build++ue4+release-4.17+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:3847]
UE4Editor_Engine!UGameInstance::InitializeForPlayInEditor() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\engine\private\gameinstance.cpp:200]
UE4Editor_UnrealEd!UEditorEngine::CreatePIEGameInstance() [d:\build++ue4+release-4.17+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:3069]
UE4Editor_UnrealEd!UEditorEngine::PlayInEditor() [d:\build++ue4+release-4.17+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:2526]
UE4Editor_UnrealEd!UEditorEngine::StartQueuedPlayMapRequest() [d:\build++ue4+release-4.17+compile\sync\engine\source\editor\unrealed\private\playlevel.cpp:1218]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\build++ue4+release-4.17+compile\sync\engine\source\editor\unrealed\private\editorengine.cpp:1549]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\build++ue4+release-4.17+compile\sync\engine\source\editor\unrealed\private\unrealedengine.cpp:396]
UE4Editor!FEngineLoop::Tick() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\launch\private\launchengineloop.cpp:3215]
UE4Editor!GuardedMain() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\launch\private\launch.cpp:166]
UE4Editor!GuardedMainWrapper() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:134]
UE4Editor!WinMain() [d:\build++ue4+release-4.17+compile\sync\engine\source\runtime\launch\private\windows\launchwindows.cpp:210]
UE4Editor!__scrt_common_main_seh() [f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253]
kernel32
ntdll

After updating my project the error occured everytime I started PIE. Then I deleted all my blueprints which used a instance static mesh component and the error vanished.

Edit: I can confirm, when no instanced static mesh components are used this crash does not occcur.

I ran into this issue as well.

In FStaticMeshInstanceBuffer::SetupCPUAccess(), the function tries to get the CVar value by calling CVar->GetValueOnGameThread(). Since nearly everything is Async Loading now, and this call can happen on the loading thread, you get the crash since it ensures that the call can only be made on the game thread.

So, you can do one of two things:

  1. Don’t Async load anything.

  2. Change the call to CVar->GetValueOnAnyThread().

I made the second change in my codebase without any issue.

Hope that helps!

Hey fxs_don,

thank you for your reply, glad you found a fix. At the moment I’m using the launcher version so I can’t apply your fix. I hope this gets some attention from Epic. Maybe you would be able to provide them a commit with the fix?

I have this same issue, I will test this fix, I hope it works :wink:

Hi

A fix was made for 4.17.2 that should be release quite soon.

Is there a release date set?

When QA approved it :slight_smile:

Alright, cool. :slight_smile:

Thank you, Mr. Dupuis, for the reply, I’m glad this issue is fixed soon.