Event Driven Loading broken / Async Loading Thread broken

Sorry about the delay. Long weekend. Here you go!

https://drive.google.com/open?id=0BwnGxHuSt_Wad2dMWm5OamNvN28

I think I’ve encountered same error.
In my build I have a number of assets that I try to load asyncronously.
Everything works fine in editor (PIE and Standalone), but packaged game crashes as soon as I get to the point where asset should be loaded. Although I haven’t dig into debugging process as throughtly as MADHOUSE did, reading his threads made me realize what most certainly the problem is.

Oh, and btw, I’m using 4.17.2

Were you able to access the project and reproduce the issue with the new link I provided?

Hi there,

I will try to address the Blueprint-nativization specific issues that were reported.

I’ve noticed another wierd issue, every second build I create from the project launcher will crash when trying to start the game with a generic “FATAL ERROR” message. The only way to fix it is to either compile the exe from VS and overwrite the one that was created in the packaged build, or delete all intermediate and saved files and run project launcher again. However if running it a second time, again it will create an exe file that will fail to start the game.

Please close the editor, check your .uproject file (e.g. in Notepad) and remove any “AdditionalPluginDirectories” entries listed as “Intermediate/Plugins” (you can remove the entire section if that is the only entry). Once removed, re-launch the editor and make sure to re-cook before attempting to rebuild the game target EXE.

In 4.17 we introduced something that writes this entry out to the .uproject file (if it’s writable) any time you set the “BlueprintNativizationMethod” setting in the “Project Settings->Packaging” UI to something other than “Disabled.” This was done to try and make it easier to locally iterate on building/debugging the EXE with Blueprint nativization enabled, but we discovered that the method has some unwanted side effects (along the lines of what you’ve run into here). We’ve since removed this in favor of a different solution in 4.18. To prevent this from happening in 4.17 when you enable Blueprint nativization, the suggested workaround is to ensure your .uproject file is read-only before changing the setting.

Missing dependency, request for X but it hasn’t been created yet.

This issue might be related to: Unreal Engine Issues and Bug Tracker (UE-48034) , which has been fixed for 4.18. I have not encountered a report of this with ‘DefaultSceneRoot’ as the ‘X’ however, so I’m not 100% sure in this case.

[2017.08.24-23.45.36:585][ 0]LogWindows: Error: Assertion failed: RecursionNotAllowed.Increment() == 1 [File:D:\Build++UE4+Release-4.17+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 4235]

First of all, thanks for taking the time to make the sample project! That always helps us to better identify an issue.

I was able to reproduce this in both 4.17.2 and 4.18 (Preview 4) by launching the sample project after building it via File->Package Project->Windows->Win64. Note: As per my note above, I did find that it was necessary to remove the “AdditionalPluginDirectories” entry from the .uproject file before choosing File->Package Project (for the reason noted above). I then made the .uproject file read-only so that it remained untouched when I changed the nativization setting. After that, I then set the Blueprint Nativization Method to “Disabled” and retried a “File->Package Project->Windows->Win64” build, which succeeded, but failed to launch with the same assertion. So this assert happens in the sample project regardless of the nativization setting.

I took a closer look at the code, and in your AMyActor::AMyActor() ctor, you’re calling FindOrLoadObject() in the non-CDO path:

AMyActor::AMyActor()
{
	if (!IsTemplate(RF_ClassDefaultObject))
	{
		FString Path("DataTable'/Game/MyStructDataTable.MyStructDataTable'");
		UDataTable* Table = ConstructorHelpersInternal::FindOrLoadObject<UDataTable>(Path);

		if (Table)
		{
			for (auto Row : Table->RowMap)
			{
				FMyStruct* pSpawners = (FMyStruct*)Row.Value;
				if (pSpawners)
				{
					MyClassToSpawn = pSpawners->ClassToSpawn;
				}
			}
		}
	}
}

I am not an EDL authority, but I believe what’s happening here is that you’re attempting to load something in the non-CDO construction path, and EDL sort of disallows that because it would cause a hitch in a streaming scenario. Instead, with EDL enabled, you’d need revise it to both handle the load at CDO creation time as well as store the result in a UPROPERTY so that the loader knows it needs to load that object before construction of the CDO instance at load time. See the ADefaultPawn class ctor for an example (how the FConstructorStatics struct is used; this is a common pattern in the engine code, as the static will be instanced on the first ctor call, which is when the CDO is constructed). Also see this section in the documentation: Gameplay Classes in Unreal Engine | Unreal Engine 5.3 Documentation

Hope this helps!

So this error has mutated into this for 4.18.

Fatal error: [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 1376]
Async loading event graph contained a cycle, see above.

Disabling nativization no longer works around the issue. Packaging without nativization produces this crash.

Fatal error: [File:D:\Build++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 1936]
FAsyncPackage::FindExistingImport class mismatch ScriptStruct != UserDefinedStruct

Greetings! Thank you very much for your informative reply.
I never looked at his sample project, but I believe a few of these issues are resolved or at least improved in 4.19. I haven’t had time to experiment around with nativization since back in August, but I’ll hopefully get some time to experiment with it again soon. I’ll try to post back with some results then. Cheers!

No problem, thanks for the followup!

So 4.19 resolved these issues? Seems like I am getting it on one of my maps (but strangely enough, not ALL my maps)

I am not using BP Nativization though. I do have Async Loading Thread enabled.

Which issue in particular are you running into in 4.19?

In 4.18.3 actually. EDL was causing a crash everytime I loaded up a particular map. Not all maps. So, turned it off, and sure enough, everyone who couldn’t load 100% of the time, was able to load into the map.

No. It still affects 4.19.

Fatal error: [File:D:\Build++UE4+Release-4.19+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 1375]
Async loading event graph contained a cycle, see above.

With same sample project as is posted above?