Description

Bulk compiling more than one Blueprint class asset without incurring a garbage collection pass in between each compile can result in a crash during reference replacement, as serialization may end up finding a reference to the current recompiled class in the build artifacts left over from a previous compile, which would otherwise have been cleaned up by garbage collection.

Currently one known instance of this occuring with the CompileAllBlueprints commandlet, which explicitly disables garbage collection as a post-compile step for performance reasons.

Steps to Reproduce

N/A (various reports) - see comments

Callstack

> UE4Editor-CoreUObject-Win64-Debug.dll!FPropertyProxyArchive::operator<<(FField * & Value) Line 46 C++
UE4Editor-CoreUObject-Win64-Debug.dll!UStruct::SerializeExpr(int & iCode, FArchive & Ar) Line 182 C++
UE4Editor-CoreUObject-Win64-Debug.dll!UStruct::Serialize(FArchive & Ar) Line 1947 C++
UE4Editor-CoreUObject-Win64-Debug.dll!UFunction::Serialize(FArchive & Ar) Line 5601 C++
UE4Editor-CoreUObject-Win64-Debug.dll!FArchiveReplaceObjectRefBase::SerializeObject(UObject * ObjectToSerialize) Line 243 C++
UE4Editor-UnrealEd-Win64-Debug.dll!FArchiveReplaceObjectRef<UObject>::SerializeSearchObject() Line 129 C++
UE4Editor-UnrealEd-Win64-Debug.dll!FReplaceReferenceHelper::FindAndReplaceReferences(const TArray<UObject *,TSizedDefaultAllocator<32>> & SourceObjects, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, const TArray<UObject *,TSizedDefaultAllocator<32>> & ObjectsToReplace, const TMap<UObject *,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UObject *,UObject *,0>> & OldToNewInstanceMap, const TMap<FSoftObjectPath,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<FSoftObjectPath,UObject *,0>> & ReinstancedObjectsWeakReferenceMap) Line 154 C++
UE4Editor-UnrealEd-Win64-Debug.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass_Inner(TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0>> & InOldToNewClassMap, UObject * InOriginalCDO, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * ObjectsThatShouldUseOldStuff, bool bClassObjectReplaced, bool bPreserveRootComponent, bool bArchetypesAreUpToDate, const TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> * InstancesThatShouldUseOldClass, bool bReplaceReferencesToOldClasses) Line 2226 C++
UE4Editor-UnrealEd-Win64-Debug.dll!FBlueprintCompileReinstancer::BatchReplaceInstancesOfClass(TMap<UClass *,UClass *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UClass *,UClass *,0>> & InOldToNewClassMap, const FBatchReplaceInstancesOfClassParameters & Options) Line 1517 C++
UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::FlushReinstancingQueueImpl() Line 1638 C++
UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl(const FBPCompileRequestInternal & Request) Line 279 C++
UE4Editor-Kismet-Win64-Debug.dll!FBlueprintCompilationManager::CompileSynchronously(const FBPCompileRequest & Request) Line 3090 C++
UE4Editor-UnrealEd-Win64-Debug.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, EBlueprintCompileOptions CompileFlags, FCompilerResultsLog * pResults) Line 754 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCompileAllBlueprintsCommandlet::CompileBlueprint(UBlueprint * Blueprint) Line 315 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCompileAllBlueprintsCommandlet::BuildBlueprints() Line 162 C++
UE4Editor-UnrealEd-Win64-Debug.dll!UCompileAllBlueprintsCommandlet::Main(const FString & Params) Line 40 C++
UE4Editor-Win64-Debug.exe!FEngineLoop::PreInitPostStartupScreen(const wchar_t * CmdLine) Line 3369 C++
UE4Editor-Win64-Debug.exe!FEngineLoop::PreInit(const wchar_t * CmdLine) Line 3591 C++
UE4Editor-Win64-Debug.exe!EnginePreInit(const wchar_t * CmdLine) Line 42 C++
UE4Editor-Win64-Debug.exe!GuardedMain(const wchar_t * CmdLine) Line 127 C++
UE4Editor-Win64-Debug.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 257 C++

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-109057 in the post.

1
Login to Vote

Fixed
ComponentGameplay - Blueprint
Target Fix4.27
Fix Commit15961809
CreatedFeb 20, 2021
ResolvedApr 8, 2021
UpdatedMay 3, 2021