HISM causes crash in build/standalone on reload level

I’m working on a game, think endless runner.
For environment meshes I’m using HISM. They get created in the Construction script. The basic loading logic is in the screenshot attached.
The game has a restart button that calls the Open Level (by name) node and restarts the same level.
This causes the game to crash both in the build and when playing in Standalone. It works perfectly in PIE and viewport.
This is the error

[2020.12.24-18.13.12:499][770]LogWindows: Windows GetLastError: La operación se completó correctamente. (0)
[2020.12.24-18.13.12:505][770]LogWindows: Error: === Critical error: ===
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:505][770]LogWindows: Error: Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/RenderCore/Private/RenderingThread.cpp] [Line: 907] 
[2020.12.24-18.13.12:505][770]LogWindows: Error: Rendering thread exception:
[2020.12.24-18.13.12:505][770]LogWindows: Error: Fatal error: [File:D:/Build/++UE4/Sync/Engine/Source/Runtime/Windows/D3D11RHI/Private/D3D11Commands.cpp] [Line: 1431] 
[2020.12.24-18.13.12:505][770]LogWindows: Error: Null SRV (resource 0 bind 0) on UB Layout FInstancedStaticMeshVertexFactoryUniformShaderParameters
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffd0d6ed759 KERNELBASE.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb47ac386 UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb47afae8 UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb44bdd5d UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca60da7af UE4Editor-D3D11RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca60d91d9 UE4Editor-D3D11RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca60eb8d3 UE4Editor-D3D11RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca61107bc UE4Editor-D3D11RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf95d971 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca895fd42 UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf967b73 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf96758c UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf968271 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf95fb12 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf965315 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf967b73 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf96758c UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf9688aa UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcbf95aea7 UE4Editor-RHI.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca8ffbe80 UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcd6054950 UE4Editor-RenderCore.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcd60586ff UE4Editor-RenderCore.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcd6053ef4 UE4Editor-RenderCore.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca8a11f7c UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca901f806 UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca8fd8e7f UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca8ff945d UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffca8ffd4f8 UE4Editor-Renderer.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb426ed11 UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb426f0fe UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcd607a422 UE4Editor-RenderCore.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcd6082af4 UE4Editor-RenderCore.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb47c7cdb UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffcb47c0970 UE4Editor-Core.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffd0df27034 KERNEL32.DLL!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: [Callstack] 0x00007ffd0fabd0d1 ntdll.dll!UnknownFunction []
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:505][770]LogWindows: Error: 
[2020.12.24-18.13.12:517][770]LogExit: Executing StaticShutdownAfterError
[2020.12.24-18.13.12:520][770]LogWindows: Error: Error reentered: Assertion failed: (PreviousValue & Mask) == Mask [File:D:\Build\++UE4\Sync\Engine\Source\Runtime\RHI\Public\RHI.h] [Line: 1993] 
RHIBeginTransitions has been called twice on this transition for at least one pipeline.

[2020.12.24-18.13.12:520][770]LogWindows: Error: HandleError re-entered.
[2020.12.24-18.13.12:520][770]LogWindows: FPlatformMisc::RequestExit(1)
[2020.12.24-18.13.12:520][770]LogCore: Engine exit requested (reason: Win RequestExit)
[2020.12.24-18.13.12:534][770]Log file closed, 12/24/20 15:13:12

This happens regardless of the type of mesh / shader (tried it with just a cube SM with the default shader) and it happens regardless of whether or not the meshes are moving. It does NOT happen if instead of HISM i use a ISM.
I have also tried the RestartGame node instead, loading a different level (also with HISMs), moving the logic from the Construction script to the BeginPlay event, all with the same result.
Spawning HISMs during runtime in the same level, via a SetTimer node works well, the problem only seems to happen when trying to load a new level or the same level.
Also tried adding instances both in world and relative space, clearing instances or not, etc.
I’m not sure if this is a bug or if I am missing something, since this is the first time I’ve used HISMs.
Thank you for any input you may give, and happy holidays! :slight_smile:

I’m having the same issue.

Eventually found a solution: The actor holding my HISMs was spawned during the game, not already placed via the editor. Once I changed it to be placed in the editor, the crash was solved.
Still, the regular HSMs do not have that problem and I didn’t have a crash even when they were part of a spawned actor.
But in case someone else has the same issue, that’s how i solve it.
I still would like to know if this is a bug or a feature

Just replied with the solution/workaround i found :slight_smile:

Definitely a bug. It works well in 4.25.I’m spawning actors containing the component during the game, so I have to wait for a fix I guess. Btw this issue only appears with DX11.

Same here. With ISM there is no problem, but If I use HISM, crash occured.

Here is my error message and call stack: link text

note: when I build with inclusive nativization option, crash does not occured.

Btw have you reported this bug?

It also works fine with DX12.

Thank you for telling that. I checked works fine with DX12 now:)

I’m also having the same issue on 4.25

HISMs spawned at runtime in packaged mode produce the following error:
Null SRV (resource 0 bind 0) on UB Layout FInstancedStaticMeshVertexFactoryUniformShaderParameters

MallocBinned2 Corruption Canary was 0xf317, should be 0x17ea

I’ve been juggling with this issue for years. It has to do with the code location where you spawn the HISMs. If the HISMs are spawned inside a ::Tick function (from FTickableGameObject, not sure if an Actor tick would be different) then it will produce the error above. If instead you spawn them before the tick function, say On OnPostWorldInitialization then it works just fine.

So I suppose that’s a form of workaround: If you really can’t place your HISMs holding actors beforehand in the editor, then hook your spawns at runtime to OnPostWorldInitialization. That’s what I do :slight_smile:

Just encountered this issue. Hopefully it’s on Epics radar for hotfixing.

It seems that this has been fixed for 4.27: Unreal Engine Issues and Bug Tracker (UE-109511) - if you use a source version of the engine, you can merge the fix in 4.26.

There may be multiple causes for such a crash, not sure if all of them are resolved with this fix. I’m saying this because this issue you linked references the fact that everything works fine in 4.25, but I’ve been encountering this issue for many years and haven’t upraded to 4.26 yet.

It’s rare but still happens time to time in each build version. 4.26.2 still has crashes

This has something to do with HISM rendering and is very random. Happens often when loading the map, but sometimes randomly during the game, when you try to update HISM instances.
Hopefully 4.27 will resolve this issue, thanks.

Also it happens more often when OBS is recording the game.
Launching the same build twice or Editor + build also increases chances of this rendering crash to occur.

4.27 still crash is there

Terrifying. People live for 1.5 years without HISMs already.

It’s possible to workaround this bug by running in -dx12 mode, but it cuts a lot of FPS and adds huge input delay

Is it still there on Preview 3? Or in latest repository commit?

Actually, it seems to work on Preview 4. But tomorrow I’ll also try on my friend’s PC, which crashed 100% times for some reason.

Great, that’s fantastic news! Default HISM crash is very annoying and has the highest severity, being reported by so many players. I tend to avoid custom engine changes, if it’s not necessary.