5.7: -run=WorldPartitionBuilderCommandlet -AllowCommandletRendering -Builder=WorldPartitionHLODsBuilder -BuildHLODs timeouts indefinitely

When running the editor with

Game -run=WorldPartitionBuilderCommandlet -AllowCommandletRendering -Builder=WorldPartitionHLODsBuilder -BuildHLODs Map -unattended

We are getting stuck in WorldPartitionHLODUtilities.cpp in the LoadSourceActors() function in the following loop:

const float STREAMING_WAIT_DT = 0.1f;

while (IStreamingManager::Get().StreamAllResources(STREAMING_WAIT_DT) > 0)

{

// Application tick.

FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread);

FTSTicker::GetCoreTicker().Tick(static_cast<float>(FApp::GetDeltaTime()));

}

During the IStreamingManager::Get().StreamAllResources() call, it calls UpdateResourceStreaming(0, true), which seems to reset all inflight streaming and recreate the streaming tasks, although I’m not familiar with the process; it does call BlockTillAllRequestsFinished() afterward and goes inside FRenderAssetStreamingManager::BlockTillAllRequestsFinished(), and we hit the following line:

UE_LOG(LogContentStreaming, Log, TEXT(“Blocking on texture streaming: %.1f ms (%d still in flight)”), BlockedMillis, NumOfInFlights);

At each loop, it gets at that same “Blocking on textute streaming”, with around the same ~100 ms value, with around the same value still in flight.

As a fix, we changed this to the following:

const float STREAMING_WAIT_DT = 0.1f;

if (IStreamingManager::Get().StreamAllResources(STREAMING_WAIT_DT) > 0)

{

do

{

// Application tick.

FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread);

FTSTicker::GetCoreTicker().Tick(static\_cast\<float\>(FApp::GetDeltaTime()));

}

while (IStreamingManager::Get().BlockTillAllRequestsFinished(STREAMING_WAIT_DT, true) > 0);

}

This solved our issue just by letting the streaming manager does it thing, and wait until everything is done.

I’d like an input if this is a correct fix.

Thanks

[Attachment Removed]

Steps to Reproduce
Game -run=WorldPartitionBuilderCommandlet -AllowCommandletRendering -Builder=WorldPartitionHLODsBuilder -BuildHLODs Map -unattended

[Attachment Removed]

Salut Jean-Luc!

Thanks for reporting this problem, I’m surprised we never ran into it ourselves. But with some testing I did repro it too.

There’s still a window where your fix would miss streaming in new resources that would have just been added by the ticking calls. This fix should avoid the reset issue while also picking up new resources that need to be streamed:

// Ensure streaming requests are completed
		// The outer loop calls StreamAllResources to discover pending assets and kick off I/O.
		// The inner loop uses BlockTillAllRequestsFinished to drain in-flight requests without
		// calling UpdateResourceStreaming, which would restart them and prevent forward progress.
		// When the inner loop finishes, the outer loop re-checks for assets the tick may have registered.
		const float STREAMING_WAIT_DT = 0.1f;
		while (IStreamingManager::Get().StreamAllResources(STREAMING_WAIT_DT) > 0)
		{
			do
			{
				// Application tick.
				FTaskGraphInterface::Get().ProcessThreadUntilIdle(ENamedThreads::GameThread);
				FTSTicker::GetCoreTicker().Tick(static_cast<float>(FApp::GetDeltaTime()));
			}
			while (IStreamingManager::Get().BlockTillAllRequestsFinished(STREAMING_WAIT_DT, true) > 0);
		}

Let me know if this works for you!

Thanks,

Sebastien

[Attachment Removed]

Closing this one for tracking, feel free to reopen it if you have any issue. Thanks!

[Attachment Removed]

Attempting your chunk of code. Thanks !

[Attachment Removed]