FStreamableHandle (used as part of the FStreamableManager system) has a CancelHandle function that stops it from calling any completion callbacks related to that handle (it could cancel the load request if that is supported by a loader). This works properly if the handle is canceled before it starts to execute the callback. However, if you try to cancel one handle from a completion/cancel callback for another handle that is processed in the same frame, it can call the completion callback after the handle has been canceled because it was already in the execution queue. This is inconsistent because the comment says this will not happen, and it could result in both the completion and cancelation callback happening for the same handle.
Code that can cause this case to occur is attached as StreamableManagerTest.cpp, with this snippet illustrating the problem:
// Given ... TSharedPtr<FStreamableHandle> A, B; int Count = 0; // ... The ensure() should not fail, but actually it fails: A = StreamableManager.RequestAsyncLoad(AssetPath, [this]() { B->CancelHandle(); ensure(++Count == 1); }); B = StreamableManager.RequestAsyncLoad(AssetPath, [this]() { A->CancelHandle(); ensure(++Count == 1); });
Expected behavior:
The automated test will succeed
Actual behavior:
The automated test will ensure and fail because it fails to cancel the handle
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-207209 in the post.
0 |
Component | UE - Foundation - Core |
---|---|
Affects Versions | 5.0, 5.5 |
Target Fix | 5.6 |
Created | Feb 16, 2024 |
---|---|
Updated | Sep 20, 2024 |