Crash when compiling Blueprints

hello,

my editor crashes after changing attributes in my Blueprints. i.e. just switching a bool from true to false and then save, hit compile and it crashes. The crashes are inconsistent, sometimes they happen sometimes they don’t.

Here the callstack, hope it helps.

 	KernelBase.dll!000007fefd3b3ca2()	Unknown
>	UE4Editor-Core.dll!FDebug::AssertFailed(const char * Expr, const char * File, int Line, const wchar_t * Format, ...) Line 160	C++
 	UE4Editor-Engine.dll!FBodyInstance::InitBody(UBodySetup * Setup, const FTransform & Transform, UPrimitiveComponent * PrimComp, FPhysScene * InRBScene, physx::PxAggregate * InAggregate) Line 713	C++
 	UE4Editor-Engine.dll!UPrimitiveComponent::CreatePhysicsState() Line 366	C++
 	UE4Editor-Engine.dll!UActorComponent::ExecuteRegisterEvents() Line 745	C++
 	UE4Editor-Engine.dll!UActorComponent::RegisterComponentWithWorld(UWorld * InWorld) Line 576	C++
 	UE4Editor-Engine.dll!AActor::RegisterAllComponents() Line 2791	C++
 	UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReplaceInstancesOfClass(UClass * OldClass, UClass * NewClass, UObject * OriginalCDO) Line 331	C++
 	UE4Editor-UnrealEd.dll!FBlueprintCompileReinstancer::ReinstanceObjects() Line 164	C++
 	UE4Editor-UnrealEd.dll!FKismetEditorUtilities::CompileBlueprint(UBlueprint * BlueprintObj, bool bIsRegeneratingOnLoad, bool bSkipGarbageCollection, bool bSaveIntermediateProducts, FCompilerResultsLog * pResults) Line 359	C++
 	UE4Editor-Kismet.dll!FBlueprintEditor::Compile() Line 2204	C++
 	UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance_NoParams<FBlueprintEditor,void,0>::Execute() Line 223	C++
 	UE4Editor-Kismet.dll!TBaseSPMethodDelegateInstance_NoParams<FBlueprintEditor,void,0>::ExecuteIfSafe() Line 250	C++
 	UE4Editor-Slate.dll!FUICommandList::ExecuteAction(const TSharedRef<FUICommandInfo const ,0> InUICommandInfo) Line 780	C++
 	UE4Editor-Slate.dll!SToolBarButtonBlock::OnClicked() Line 293	C++
 	UE4Editor-Slate.dll!TBaseSPMethodDelegateInstance_RetVal_NoParams<SToolBarButtonBlock,FReply,0>::Execute() Line 223	C++
 	UE4Editor-Slate.dll!TBaseDelegate_RetVal_NoParams<FReply>::Execute() Line 996	C++
 	UE4Editor-Slate.dll!SButton::OnMouseButtonUp(const FGeometry & MyGeometry, const FPointerEvent & MouseEvent) Line 185	C++
 	UE4Editor-Slate.dll!FSlateApplication::ProcessMouseButtonUpMessage(FPointerEvent & MouseEvent) Line 3576	C++
 	UE4Editor-Slate.dll!FSlateApplication::OnMouseUp(const EMouseButtons::Type Button) Line 3544	C++
 	UE4Editor-Core.dll!FWindowsApplication::ProcessDeferredMessage(const FDeferredWindowsMessage & DeferredMessage) Line 1177	C++
 	UE4Editor-Core.dll!FWindowsApplication::DeferMessage(TSharedPtr<FWindowsWindow,0> & NativeWindow, HWND__ * InHWnd, unsigned int InMessage, unsigned __int64 InWParam, __int64 InLParam, int MouseX, int MouseY, unsigned int RawInputFlags) Line 1468	C++
 	UE4Editor-Core.dll!FWindowsApplication::ProcessMessage(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 595	C++
 	UE4Editor-Core.dll!FWindowsApplication::AppWndProc(HWND__ * hwnd, unsigned int msg, unsigned __int64 wParam, __int64 lParam) Line 461	C++
 	[External Code]	
 	UE4Editor-Core.dll!WinPumpMessages() Line 582	C++
 	UE4Editor-Core.dll!FWindowsPlatformMisc::PumpMessages(bool bFromMainLoop) Line 610	C++
 	UE4Editor.exe!FEngineLoop::Tick() Line 1967	C++
 	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 132	C++
 	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 196	C++
 	[External Code]

I’m getting this crash too, it’s a nasty one. It happens when I’m editing a blueprint based on Character and I click the Defaults Pane before clicking the Components pane. Here’s my analysis: (I’ve included some pointer values to show when the same objects reappear)

Click Defaults

  • FPrimitiveComponentDetails::OnGetBodyMass calls CalculateMass on CDO’s CapsuleComponent @ 0x000000001148c800 (Name=0x00000000023dd030 “CollisionCylinder”)
  • Which creates a body setup @ 0x000000001ffd9580 (Name=0x0000000005337bc8 “BodySetup”_0x00000003)

Click Components

  • Spawns an actor @ 0x000000000b865d00 (Name=0x0000000002644728 “HeroCharacter_C”_0x00000000)
  • CapsuleComponent @ 0x000000000b865600 (Name=0x00000000023dd030 “CollisionCylinder”)
  • ShapeBodySetup null in constructor
  • FPostConstructInitializeProperties::InitProperties on the CapsuleComponent copies the body setup by pointer @ 0x000000001ffd9580 from the property ShapeBodySetup even though that property is marked Transient and DuplicateTransient.

So the preview actor and the BlueprintGeneratedClass’s CDO now share a body instance, which is probably the first bug.
Now blueprint reinstancing enters the mix!

Click Compile

  • FBlueprintCompileReinstancer duplicates class
  • UBlueprintGeneratedClass::PostLoad called
  • CDO of duplicate class is still the same as the old class
  • Body Setup @ 0x000000001ffd9580 (Name=0x0000000005337bc8 “BodySetup”_0x00000003) is marked Pending Kill because it’s not a default subobject of the CDO
  • FBlueprintCompileReinstancer wants to recreate actor @ 0x000000000b865d00 (Name=0x0000000002644728 “HeroCharacter_C”_0x00000000) whose CapsuleComponent’s body instance @ 0x000000001ffd9580 is already pending kill
  • UEditorEngine::CopyPropertiesForUnrelatedObjects copies the RF_PendingKill BodySetup from the old actor to the new by pointer, so it now shares the pending kill body instance with the old actor and the CDO
  • AActor::RegisterAllComponents is called on the new actor and the engine asserts that the BodySetup is invalid in FBodyInstance::InitBody

So a few things seem dodgy:

  1. The CDO creating a body instance at all
  2. The preview actor sharing the CDO’s body instance instead of nulling that property and creating its ow
  3. The duplicate blueprint generated class CDO pointing at the old class CDO during duplication
  4. The BlueprintGeneratedClass duplicate having PostLoad called and that messing with the body setup
  5. The new preview actor’s capsule component in reinstancing having a Transient, DuplicateTransient property copied across from the old actor’s component

Fixing any one of these would probably fix the crash but they all seem in need of addressing.

Hello,

I am experiencing this crash everytime I try to compile any character blueprint in my project. I have tried moving the character to a clean new project and compiling and it still crashes. Sometimes compiling an already compiled character blueprint helps prevent the crash when the modified blueprint is compiled but this work around is no longer working. I have attached the crash dump and the log file. link text

Hi everyone,

Does this happen on a specific blueprint or any that you try to open? Further, does this happen in a specific project or will the editor crash in a blank project with no additional content? Thank you and have a great day!

Hello again :),

I am experiencing this issue mainly with character blueprints. I don’t recall the editor crashing while trying to compile any other blueprints. I experience the issue with a new blank project as well. It happens after working with the character blueprint for sometime and then trying to compile. This issue mainly happens when I modify some of the default properties either from the components tab or the default properties tab. The properties could be anything. For example adjusting the collision capsule height and recompiling sometimes causes a crash or rotating the character mesh and recompiling crashes it. Even adding components and compiling sometimes results in crashes. I haven’t experienced a crash while working with the event graph or the construction script portions of it as of now. It mainly seems to be modification(s) made to components or additions of new ones.

Hi ,

We were able to reproduce this on our end and have attached this along with my findings to a bug report for assessment. Thank you and have a great day!

hi there,

i’m pretty sure this issue was fixed by CL# 2051070. unfortunately it did not make it into 4.1, but you can see the change here:

https://github.com/EpicGames/UnrealEngine/commit/f6ff8ac712978470835d58f2657acf74c5d31f46

it should also be fixed in the next release. hope this helps!