Crash due to "Loading is stuck, flush will never finish"

Hi,

Recently was confronted with a crash due to asyncloading2 hitting s.StallDetectorTimeout limit, resulting in a crash with the message “Loading is stuck, flush will never finish”.

After some investigation, I found out that a new optimization added to WorldPartitionHandle.cpp was causing FlushAsyncLoading to be called globally for all assets at once and in our assets and usage, it was causing timeouts (it was actually deadlocks).

In FWorldPartitionLoadingContext::FDeferred::~FDeferred(), if AllAsyncLoadIds is empty, the call to FlushAsyncLoading will result in a flush of everything currently being streamed. The fix is just to avoid doing a FlushAsyncLoading if AllAsyncLoadIds is empty.

I assume that there could be more complicated reasons underneath on why the timeout is hit. Every time it would crash with a timeout, the level being loaded always had AllAsyncLoadIds empty and multiple other level instances were being loaded at the same time. The callstack would also already contain a BlockTillLevelStreamingCompleted() coming from ULevelStreamingLevelInstance::LoadLevelInstance().

Hope this helps,

Have a nice day!

Salut Maxime,

Thanks for reporting the problem. I’ll talk to the teams regarding the best way to get this resolved.

Martin

Fix submitted as CL44424725 on UE5\Main. I missed the 5.6.1 cutoff so you will have to keep your code in there until 5.7.

Thanks for the report!

Martin