We’re seeing crashes in our game cook show up in our build farm every 10-15 builds. It appears to be an issue in FWorldPartitionActorDescInstance where the callback for LoadPackageASync in FWorldPartitionActorDescInstance::StartAsyncLoad is being called after the instance is already destroyed and garbage.
I tried some things to investigate what’s happening:
* Confirmed that AsyncLoadID is NONE by the time the destructor is called (check (AsyncLoadID == INDEX_NONE))
* Confirmed that ActorDesc is not changed while the async load is happening
It looks like, even though we call MarkUnload which in turn calls FlushAsyncLoading(AsyncLoadID), there is still a possibility that the completion callback is called later on. I’m not sure if this intended behavior from the package streaming module or if this is a bug there. We thought it might be related to CL 48035886, but integrating it did not fix the issue for us.
We’re trying now to do a local workaround where we capture a level of indirection (a shared pointer) into the lambda so that we can safely invalidate the callback from reaching us after the object is destroyed. However it would be nice to figure out the root cause of this and fix it in the upstream engine.
[Attachment Removed]