Description

Licensee has reported intermittent crashes when loading a map that contains Child Actors with Text Render Components.

When the child actor blueprint is spawned all of the text render components stack up a bunch of end-of-frame updates, which all end up in the UWorld::ComponentsThatNeedEndOfFrameUpdate() array. As you may know, these are processed concurrently on worker threads dispatched in UWorld::SendAllEndOfFrameUpdates().

Unfortunately, these end of frame updates include a lot of initialization processing, among other things the instantiation of the scene proxy. A lot of this processing is not safe to be executed concurrently, as (among other things) it makes calls to the non-concurrent version of UMaterialInstance::GetMaterial(), where the reentrancy guard falls on its face because it can't tell the difference between a redundant call due to cyclical reference or due to execution on concurrent threads. This is the proximate cause of the issue, but the ultimate cause is that this stuff simply isn't safe to run concurrently in the current implementation.

The quick & dirty fix is to override RequiresGameThreadEndOfFrameUpdates() in TextRenderComponent and have it return 'true', which will force the TextRenderComponent initialization to be executed serially on the game thread instead of concurrently.

Internal discussion also indicates there's an issue:

There are unsafe calls to GetMaterial in the type constructor and it also internally creates an MID on top of whatever you're using, but an MID from an MID is not intended to my understanding so that could cause additional issues under the hood as well as adding unnecessary overhead.

Steps to Reproduce

repro steps not currently known. Licensee provided the following (although it did not reproduce internally)

1. Create a blueprint with multiple TextRenderComponents all referencing the same material instance. You may need a large number to get the problem to occur. I'd use at least a dozen.
2. Reference that blueprint as a child actor of another blueprint. Spawn that parent blueprint or drag it into the level.
3. Run the game. Preferably a standalone development build of some kind.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-42454 in the post.

1
Login to Vote

Won't Fix
ComponentUE - Graphics Features
Affects Versions4.144.15
CreatedFeb 28, 2017
ResolvedAug 18, 2021
UpdatedAug 18, 2021
View Jira Issue