Crash when assembling a metahuman character

Hello,

We’ve switched from 5.6 to 5.7 and our art team is running into a systematic crash when using Assemble on a metahuman character.

We first ran into a crash caused by a mismatch in package virtualization between the Metahuman engine plugin content and the game content (See related question [Content removed]

Once we worked around that crash, we ran into an other crash.

The assembly process runs fine but shortly after, when the assets are saved (or auto-saved) a crash occurs in the render thread due to a dangling pointer to a MaterialInstanceComponent (see callstack field).

I did isolate the moment where the MaterialInstanceComponent gets destroyed causing the dangling pointer, here is the callstack of the GC call

>	UnrealEditor-Engine.dll!UMaterialInstance::~UMaterialInstance() Line 1058	C++
 	[Inline Frame] UnrealEditor-Engine.dll!UMaterialInstanceConstant::{dtor}() Line 471	C++
 	UnrealEditor-Engine.dll!UMaterialInstanceConstant::`vector deleting destructor'(unsigned int)	C++
 	UnrealEditor-CoreUObject.dll!FObjectPurge::DestroyObjects(bool bUseTimeLimit, double TimeLimit, double StartTime) Line 914	C++
 	UnrealEditor-CoreUObject.dll!IncrementalDestroyGarbage(bool bUseTimeLimit, double TimeLimit) Line 5064	C++
 	UnrealEditor-CoreUObject.dll!IncrementalPurgeGarbage(bool bUseTimeLimit, double TimeLimit) Line 4721	C++
 	UnrealEditor-CoreUObject.dll!UE::GC::PostCollectGarbageImpl<1>(EObjectFlags KeepFlags) Line 5778	C++
 	UnrealEditor-CoreUObject.dll!UE::GC::FReachabilityAnalysisState::PerformReachabilityAnalysisAndConditionallyPurgeGarbage(bool bReachabilityUsingTimeLimit) Line 5970	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!UE::GC::CollectGarbageInternal(EObjectFlags) Line 5525	C++
 	UnrealEditor-CoreUObject.dll!CollectGarbage(EObjectFlags KeepFlags, bool bPerformFullPurge) Line 6216	C++
 	UnrealEditor-Kismet.dll!FBlueprintCompilationManagerImpl::CompileSynchronouslyImpl(const FBPCompileRequest & Request) Line 412	C++
 	UnrealEditor-UnrealEd.dll!FBlueprintEditorUtils::PostDuplicateBlueprint(UBlueprint * Blueprint, bool bDuplicateForPIE) Line 1750	C++
 	UnrealEditor-Engine.dll!UBlueprint::PostDuplicate(bool bDuplicateForPIE) Line 636	C++
 	UnrealEditor-RigVMDeveloper.dll!IRigVMAssetInterface::PostDuplicate(bool bDuplicateForPIE) Line 2984	C++
 	[Inline Frame] UnrealEditor-ControlRigDeveloper.dll!URigVMBlueprint::PostDuplicate(bool) Line 195	C++
 	UnrealEditor-ControlRigDeveloper.dll!UControlRigBlueprint::PostDuplicate(bool bDuplicateForPIE) Line 255	C++
 	UnrealEditor-CoreUObject.dll!StaticDuplicateObjectEx(FObjectDuplicationParameters & Parameters) Line 3306	C++
 	[Inline Frame] UnrealEditor-CoreUObject.dll!StaticDuplicateObject(const UObject *) Line 3116	C++
 	UnrealEditor-CoreUObject.dll!DuplicateObject_Internal(UClass * Class, const UObject * SourceObject, UObject * Outer, const FName Name) Line 4910	C++
 	UnrealEditor-MetaHumanCharacterEditor.dll!DuplicateObject<UObject>(const UObject * SourceObject, UObject * Outer, const FName Name) Line 1980	C++
 	UnrealEditor-MetaHumanCharacterEditor.dll!FMetaHumanCharacterEditorBuild::DuplicateDepedenciesToNewRoot(const TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> & InDependencies, const FString & InDependencyRootPath, TSet<UObject *,DefaultKeyFuncs<UObject *,0>,FDefaultSetAllocator> & InOutObjectsToReplaceWithin, TMap<UObject *,UObject *,FDefaultSetAllocator,TDefaultMapHashableKeyFuncs<UObject *,UObject *,0>> & OutDuplicatedDependencies, TFunction<bool __cdecl(UObject const *)> InIsAssetSupported) Line 1009	C++

Cheers,

Benjamin

[Attachment Removed]

Hello,

I have an update regarding this crash. We did find a workaround to this by doing the following:

* modifying the “DuplicateDepedenciesToNewRoot” function to list all the “Material Instances” that need to be duplicated/replaced

* running the assembly to extract that list

* killing the editor and deleting the files in the project for all the “Material Instances” requiring a replacement

* reruning the editor and running the assembly

After applying the workaround, the Assembly can now run properly and the assets can be saved without crashing.

We do not know if the fix will take (as-in, other metahuman assets can now be assembled without applying the same workaround).

Weirdly I did revert all changes (including running a reconcile offline changes) and I could now assemble another Metahuman asset that was previously crashing.

Cheers,

Benjamin

[Attachment Removed]