Editor Crash - Assertion failed: UnderlyingResource->GetRefCount() == 1

Hey,

We’re repeatedly getting editor crashes with the error

LogWindows: Error: appError called: Assertion failed: UnderlyingResource->GetRefCount() == 1 [File:D:\build\++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12Resources.cpp] [Line: 1313]

This occurs at lots of different points, such as moving the view port around whilst editing lights or animation view port mode. It also crashes when finishing a render through the movie render queue with the same error.

Any help / direction on what to troubleshoot would be appreciated!

3 Likes

i having the same issue, i think its because of low vram, are you using a rtx?

Just started happening to me too, suddenly any mesh I import into a 5.5.1 project crashes with this error a second or two after import completes. RTX 4090, plenty of free VRAM when this occurs.

Update: Crash was tied to a specfic map which had nanite-enabled landscape. As that was the most recent and unfamiliar-to-me feature I had used, I disabled it. This didn’t resolve things, so I reinstalled Nvidia drivers and updated streaming pool settings (was getting an over-budget warning - though I had been long before the crashes started). Re-enabled nanite on the LS, and things appear to be resolved so far.

I’ve got the same issue – crashes are pretty irregular, moving around in the view port, editing metahumans, opening assets. It also crashes after finishing a movie render queue. Has anyone found a fix yet? On a 4090

This is happening to me too, and I can confirm it’s happening when I’m working on only one of my levels, but for the life of me I can’t determine what’s causing the problem nor the nature of it as I don’t understand what the error code is trying to tell me.

Also happening to me on a RTX 4070

I’ve struggled with this as well, trying on 5.5.0 and 5.5.1 - using editor, rendering, adjusting sequencer, all giving the same crash results.

This may not work for everyone, but disabling SM6 Shaders in the Project Settings seems to have stabilized my workflow for the time being.

While some shader features seem to have been lost, fixing those shaders when I get round to rendering the final animation can be a “Future Jake” problem… :sweat_smile:

But for now, while doing Previs and rough cuts of my animation, I can edit an animate my metahumans without the fear of me breathing in the wrong direction and causing UE to combust.

Hope this helps at least one other person!

Just checking in to see if anyone has found a solution?

I get the same issue when I finish rendering in Movie Rendee queue. i have plenty VRAM & am on RTX4090.

Assertion failed: UnderlyingResource->GetRefCount() == 1 [File:D:\build++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12Resources.cpp] [Line: 1313]

To add to the growing list of users experiencing this issue, we are in the same boat. The crashes are very frequent, sometimes occurring only after a few minutes of opening the editor and moving the mouse around. And the crashes only occur in 5.5.x. Because the crashes are so frequent, our workflow efficiency has been hindered immensely. Many days we’ll experience 40+ crashes in a single day. :frowning_face:

The error is the same every time:
LogWindows: Error: appError called: Assertion failed: UnderlyingResource->GetRefCount() == 1 [File:D:\build++UE5\Sync\Engine\Source\Runtime\D3D12RHI\Private\D3D12Resources.cpp] [Line: 1313]

I have opened a UDN ticket on this today in the hopes they can provide a fix or workaround.

1 Like

Have people tried connecting this issue to their Nvidia driver? Curious as I was having no crashes for weeks until today. After reinstalling the latest Studio driver I’ve yet to experience a crash. Also, working in a different project resulted in 0 crashes like this.

Hello,

This crash seems related to streaming in large textures (8K and above), but we haven’t been able to reproduce it internally or understand how it might happen by just examining the code. Is anybody in this thread able to apply some code modifications and reproduce the crash, so we can get more information? If so, please replace the check() in D3D12Resources.cpp at line 1313 with the following block:

uint32 RefCount = UnderlyingResource->GetRefCount();
if (RefCount != 1)
{
	FString UnderlyingResName = UnderlyingResource->GetName().ToString();
	FString OwnerName = TEXT("UNKNOWN");
	if (Owner && Owner->GetResource())
	{
		OwnerName = Owner->GetResource()->GetName().ToString();
	}
	UE_LOG(LogD3D12RHI, Fatal, TEXT("Underlying resource has unexpected ref count %u, name: %s, owner name: %s"), RefCount, *UnderlyingResName, *OwnerName);
}

If the crash still occurs, please attach the last few lines in the log (there should be a fatal error at the end, instead of the assertion failure you get now).

Would it be possible to simplify one of the crashing projects and share it with us, so we can debug it? It should be possible to remove most things except the high-res textures and the assets which use them. (We’ve built a streaming stress test project with large textures internally, but so far haven’t been able to reproduce the issue.)

Hi! I have the same problem and I tried your fix but im still getting the same error. Ill attach the log file here
MasterEnv_01.log (195.3 KB)

Hi,

The code change I posted wasn’t a fix for the issue, it’s just outputting more information to the log so we can hopefully understand what’s going on. It doesn’t look like you were running with it when that log file was written, because it was supposed to change the error message to a fatal error saying “Underlying resource has unexpected ref count […]”, but your log still has the assert message from the vanilla code. Did you build the engine after applying the change?

Same issue! im getting it in animation mode, while animating MH with ctrl rig. and i also have 4090, and i also have the latest studio driver. i guess it may be problem on nvidia’s side, with driver

(I’m on a 4070 in UE 5.5.0, about to update.)

Hey all, IDK if this will help Epic but it happens to me a lot more often when I’m switching to foliage mode.

If I do get into foliage mode then often when I click on one/multiple foliage types to turn them on and off it will crash for me at that time.

When I use the r.streaming.poolsize = 8000 code it SEEMS to buy me some time but I can’t be sure there either. (This all seems fairly random to me -just trying to help.)

I can’t be sure but it SEEMS to happen more often when my sequencer is open.

(I have a metahuman with rig not deleted in the sequencer, hidden in game, and a few particle systems hidden in the level. Sorry if this is irrelevant… haha.)

Good luck and thanks!

  • AMD Ryzen 9 5950X 16-Core Processor
  • NVIDIA GeForce RTX 4090
  • Windows 11 (23H2) [10.0.22631.4751]
  • UE 5.5.1

I replaced lined 1313 in D32D12Resources.cpp with the block you provided, here are the last lines of my log file…

[2025.01.31-21.39.02:218][571]LogConfig: Applying CVar settings from Section [ShadingQuality@2] File [Scalability]
[2025.01.31-21.39.02:231][571]LogOptionsCommonImageBase: Warning: Button Clicked
[2025.01.31-21.39.02:251][572]LogRenderer: Display: Recreating Shadow.Virtual.PhysicalPagePool due to size or flags change. This will also drop any cached pages.
[2025.01.31-21.39.02:309][572]LogRenderer: Display: Recreating Shadow.Virtual.PhysicalPagePool due to size or flags change. This will also drop any cached pages.
[2025.01.31-21.39.02:406][573]LogContentStreaming: Texture pool size now 800 MB
[2025.01.31-21.39.02:406][573]LogCsvProfiler: Display: Metadata set : streamingpoolsizemb="800"
[2025.01.31-21.39.02:479][579]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-21.39.02:479][579]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-21.39.02:554][586]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-21.39.02:619][592]LogWindows: Error: appError called: Fatal error: [File:L:\UE\5.5.1\Engine\Source\Runtime\D3D12RHI\Private\D3D12Resources.cpp] [Line: 1323] 
Underlying resource has unexpected ref count 2, name: D3D12RHIObjectUniqueName201, owner name: D3D12RHIObjectUniqueName201

The game crashed when I played PIE mode, and the overall scalability quality was changed from Epic to High from my Options menu. Sometimes the crash occurs randomly while using the editor.

[2025.01.31-23.09.14:124][899]LogLookAtInspectCommonUserWidget: ULookAtInspectCommonUserWidget: Is Inspecting
[2025.01.31-23.09.14:169][902]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 8388608 bytes
[2025.01.31-23.09.14:169][902]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 8388608 bytes
[2025.01.31-23.09.14:169][902]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 8388608 bytes
[2025.01.31-23.09.14:169][902]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 8388608 bytes
[2025.01.31-23.09.14:235][906]LogLookAtInspectCommonUserWidget: ULookAtInspectCommonUserWidget: Is Inspecting
[2025.01.31-23.09.14:260][908]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-23.09.14:486][923]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-23.09.14:672][935]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-23.09.14:784][942]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-23.09.14:892][949]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-23.09.14:919][951]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.01.31-23.09.15:009][957]LogWindows: Error: appError called: Fatal error: [File:L:\UE\5.5.1\Engine\Source\Runtime\D3D12RHI\Private\D3D12Resources.cpp] [Line: 1323] 
Underlying resource has unexpected ref count 2, name: D3D12RHIObjectUniqueName549, owner name: D3D12RHIObjectUniqueName549

This one crashed while interacting with an object

Let me know If I can help with further troubleshooting.

@carpizofdz I’m getting the same crash, but thanks for dropping your log in - I’m supposed to be presenting an animation sequence tomorrow and am getting intermittent crashes because of this error… Nervewracking! Got a 16k texture in my scene on a landscape which I believe is my culprit (which I may just have to nuke down to half res)

Is your error easily replicable? I will try increasing my texture streaming pool size but since my error isn’t easily replicable it might take me a while to confirm whether this is a workaround.

If your crash is replicable, try increasing your pool size with r.Streaming.PoolSize 10000 (default is 1000). Will report back if the crash occurs again on my end.

Thanks for the extra info. Unfortunately this resource isn’t named, so it’s still difficult to say what’s causing the crash. Can you try replacing that debug code with this updated version?

uint32 RefCount = UnderlyingResource->GetRefCount();
if (RefCount != 1)
{
	FString UnderlyingResName = UnderlyingResource->GetName().ToString();
	FString OwnerName = TEXT("UNKNOWN");
	if (Owner && Owner->GetResource())
	{
		OwnerName = Owner->GetResource()->GetName().ToString();
	}

	const D3D12_RESOURCE_DESC& Desc = UnderlyingResource->GetDesc();
	UE_LOG(LogD3D12RHI, Fatal, TEXT("Underlying resource has unexpected ref count %u, name: %s, owner name: %s, Heap Type: %u, Dimension: %u, Width: %llu, Height: %u, Flags: %u"),
		RefCount, *UnderlyingResName, *OwnerName, UnderlyingResource->GetHeapType(), Desc.Dimension, Desc.Width, Desc.Height, Desc.Format, Desc.Flags
	);
}

This prints more information about the resource, maybe we can figure out what it is from the dimensions, type and flags.

[2025.02.05-23.41.09:623][526]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.02.05-23.41.09:766][533]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.02.05-23.41.10:222][557]LogCrosshairCommonUserWidget: HandleOnFirstPersonCharacterDataIsLookingAtInteractable
[2025.02.05-23.41.10:464][570]LogD3D12RHI: Display: Temp texture streaming buffer not large enough, needed 16777216 bytes
[2025.02.05-23.41.10:573][576]LogWindows: Error: appError called: Fatal error: [File:L:\UE\5.5.1\Engine\Source\Runtime\D3D12RHI\Private\D3D12Resources.cpp] [Line: 1325] 
Underlying resource has unexpected ref count 2, name: D3D12RHIObjectUniqueName288, owner name: D3D12RHIObjectUniqueName288, Heap Type: 1, Dimension: 3, Width: 8192, Height: 8192, Flags: 76

The issue may be caused by the 8k textures used for metahumans. I will try setting the max texture size to 4 or 2k and see if that helps.

Thanks for the log. As far as we’ve seen, it only happens with 8k textures or bigger, though we can’t explain why yet. Please let us know if it’s still happening after reducing to 4k. In the mean time I’ll try to use Metahuman to reproduce the issue, as the error message didn’t uncover a lot of detail, besides it being a regular GPU texture (not an upload buffer or anything like that).

BTW my code above has a mistake and prints the format as the flags, if anybody else wants to run with it please use this instead:

uint32 RefCount = UnderlyingResource->GetRefCount();
if (RefCount != 1)
{
	FString UnderlyingResName = UnderlyingResource->GetName().ToString();
	FString OwnerName = TEXT("UNKNOWN");
	if (Owner && Owner->GetResource())
	{
		OwnerName = Owner->GetResource()->GetName().ToString();
	}

	const D3D12_RESOURCE_DESC& Desc = UnderlyingResource->GetDesc();
	UE_LOG(LogD3D12RHI, Fatal, TEXT("Underlying resource has unexpected ref count %u, name: %s, owner name: %s, Heap Type: %u, Dimension: %u, Width: %llu, Height: %u, Format: %u, Flags: %u"),
		RefCount, *UnderlyingResName, *OwnerName, UnderlyingResource->GetHeapType(), Desc.Dimension, Desc.Width, Desc.Height, Desc.Format, Desc.Flags
	);
}

Writing code directly in a forum reply window is not great. :slight_smile:

1 Like