Streaming Manager Update Crash on Landscape Proxy following code change in 5.7 (CL 42967251)

Hi,

We’re seeing an intermittent crash in 5.7 that appears to be related to changes made in CL 42967251. It is exclusive to game builds and does not reproduce in editor builds due to editor specific logic that prevents it.

That CL modifies ULandscapeComponent::GetStreamingRenderAssetInfo() in such a way that it now queries the owning world of the Landscape proxy to determine the RHI feature level. The short version of the story is that it’s occasionally the case that the proxy is inside a level that has no owning world, causing a nullptr dereference.

The long version is that when a level is removed from the world - say due to being streamed out as part of World Partition - UWorld::RemoveFromWorld() is called which then calls FRenderAssetStreamingManager::RemoveLevel() and then later the level’s owning world is set to null. The streaming manager doesn’t actually remove the level though unless it’s an editor build or the level is being destroyed, neither of which is true at this stage.

Then, if we change render settings and material quality is modified, FRenderAssetStreamingManager::ConditionalUpdateStaticData() gets called and forcibly removes and re-adds all the levels including those will null owning worlds, which will later cause them to get rebuilt.

The later in a different tick, FRenderAssetStreamingManager::UpdateResourceStreaming() is called which ultimately leads to the crash by calling ULandscapeComponent::GetStreamingRenderAssetInfo() and accessing the null owning world on the level.

I’m hoping you might be able to suggest a fix or workaround for this crash? I assume it’s safe for us to locally revert the changes in CL 42967251 if we’re not using the mobile renderer?

Thanks,

Woody

[Attachment Removed]

Steps to Reproduce
In a world partition world, in a game build (does not reproduce in editor builds) cause a level to stream out and then immediately change material quality. This occasionally, but not consistently, leads to a nullptr dereference a few moments later.

[Attachment Removed]

I confirm that I have the same issue here. Reverting the CL 42967251 fixed the issue as well

[Attachment Removed]

Confirmed that we also have the same issue here since 5.7 update

[Attachment Removed]

Hi and sorry for the delay,

Thank you for your post, there’s indeed an edge case where a primitive component is being added to the asset streaming manager despite having no valid world. I have submitted a workaround (https://github.com/EpicGames/UnrealEngine/commit/eb036efb2e98bc2b6d5e68bc53c5006b76d29ba5\) and checked with your repro steps that it works as expected (as in : it doesn’t crash). It was already what we were doing in other some other ULandscapeComponent functions. I have also validated that eventually, when its owning level gets streamed in again, the primitive component gets properly added to the streaming manager, this time with a valid world, which allows to retrieve the proper feature level.

I have also informed the team in charge of the asset streaming manager of this case so that they can ponder on the validity of letting such primitive components be added.

Cheers,

Jonathan

[Attachment Removed]

Hi, is the fix planned for UE5.7 hotfix? Having similar issue with UE5.7.3. Not sure if the landscape proxy crashes, but crash happens at edge of stream grid in packaged game. When ending game it gives this crash error even in editor (if its related):

appError called: Assertion failed: Primitives.Num() == 0 [File:D:\build++UE5\Sync\Engine\Source\Runtime\Renderer\Private\RendererScene.cpp] [Line: 1240] All primitives are expected to be removed before the scene is destroyed. Remaining primitives are likely to cause a memory leak.