Trash components cause UE4.10.1 crash

Recently I converted my project from 4.9 to 4.10.1, and always get crash every time when I closing a PIE session or closing blueprint window.
This never happened in 4.9.

If I run PIE and stop, or open my blueprint and close it, engine will crash in SceneComponent.cpp line 680:

checkf(ChildCount > AttachChildren.Num(), TEXT(“AttachChildren count increased while detaching ‘%s’, likely caused by OnAttachmentChanged introducing new children, which could lead to an infinite loop.”), *Child->GetName());

I also found similar bug report, but I found more easily way and more information about this crash.

This bug can reproduce in blank UE4.10 and UE4.9 C++ project.
However in UE4.9 only have incorrect behavior, but this incorrect behavior caused crash in UE4.10.

Reproduce steps:
1 Create a C++ class called MyBaseActor as attached files shows [link text][1].

2 Create a BP class MyFirstBPActor derived from MyBaseActor
Add a variable “manager” which type is Actor.

3 Create a BP class DerivedBPActor derived from MyFirstBPActor

4 Create a BP Interface ActorManagerInterface which has 2 functions

Briefly writting in C++ is:

one is DerivedBPActor FindActor( FName name );

other is bool ExecuteActor( DerivedBPActor );

As ExecuteActor.png and FindActor.png shows.



5 Edit Construction script in “both” DerivedBPActor and MyFirstBpActor:

Add codes such like: (written in C++ like)

out = manager->FindActor( "actorName" );

bool success = manager->ExecuteActor( out );

As NodesInDerivedBPActorAndMyFirstBPActor.png shows.

6 Compile all class, save, and reopen UE4.

7 Open MyFirstBPActor and close it. It works fine.

8 Open DerivedBPActor and close it. It gets crash.

If we print children components of DerivedBPActor in ConstructionScript.

It shows 4 children components:

LogBlueprintUserMessages: [DerivedBPActor_C_0] Component nums: 4

LogBlueprintUserMessages: [DerivedBPActor_C_0] TRASH_Default__MyFirstBPActor_C_0.CapsuleComponent

LogBlueprintUserMessages: [DerivedBPActor_C_0] TRASH_Default__MyFirstBPActor_C_0.StaticMeshComponent

LogBlueprintUserMessages: [DerivedBPActor_C_0] DerivedBPActor_C_0.CapsuleComponent

LogBlueprintUserMessages: [DerivedBPActor_C_0] DerivedBPActor_C_0.StaticMeshComponent

crash condition in this case (SceneComponent.cpp line 680) is

ChildCount=2 > AttachChildren.Num()=2, so checkf fails.

It is because parent of TRASH_Default__MyFirstBPActor_C_0.StaticMeshComponent is not DerivedBPActor->RootComponent.

Please let me know if you require more information.
Thank you.


Thank you for posting additional information regarding this issue. This bug exists in our system as UE-23366. I will update report with additional information you have provided.

Have a great day,

Sean Flint

Because this problem cause me stop working.
(Crash on everytime when stoping PIE is very hard for coding)

I almost take my full time to study actor/component initialize flow.

Therefore, there are more detailed information and can not directly post here.

After today, I found problem of this crash are related to:

  1. function AttachTo(RootComponent); on construction(const FObjectInitializer& ObjectInitializer) in C++ code.

  2. circular Dependency between blueprints (even if using blueprint Interface).

If staff of unreal engine wants more information, please post here or PM me, I will reply as soon as possible.

Do you have any new information?
Thank you.

Currently, this bug is still being investigated. I will post updates here as they become available. Thank you.

just checking in to inform, this still happens in 4.11 preview 2

I have created a new JIRA for this issue, as it is slightly different from original issue which was reported as UE-23366 and fixed. new JIRA is UE-25360.

do you know if this is being worked on for 4.11? i basically cannot work on my project

Hi Chosker,

Bug Report has been entered, and crash bugs usually get priority for developer investigation. It seems it’s related to first bug which was already fixed, so hopefully cause of this crash can be found quickly. We cannot guarantee that anything will be fixed for any particular release, however, though effort is being made.

For now, I would recommend continuing development in 4.9 if at all possible. If not, try other PIE methods (such as Standalone Game) to see if same thing happens. Otherwise, you might need to utilize Launch functionality, though this can be time consuming. We apologize for inconvenience.

crash also occurs just by opening my main landscape map in editor - so I can only work on my test map, so it’s not just about launching game.

btw I can’t roll back to 4.9 without a lot of pain because I’ve already worked on plenty of stuff and re-saved it. my best option is really to wait for a fix and work on my UDK project in meantime

It might be worth entering a second Bug Report for map crash. Can you paste information from Crash Reporter window when that occurs, including Machine ID, and hit Send so we can look it up here and verify? If it’s same, I’d want to add that information to existing report, and if not, I’d like to enter a second report. Thanks!

Again, I can’t guarantee any fix will be implemented in 4.11’s release. You’re certainly welcome to wait, but it might be worth investing time in alternative solutions.

I debugged provided project and determined that problem is in how you are setting up CameraBoom attachment, not with engine code (well other than you can do this to yourself, but different thing).

In BaseCharacter.cpp you use AttachTo to set attachment of boom to RootComponent, however, in EliumCharacter.cpp you simply set AttachParent directly. This is leaving an inconsistency between AttachChildren array of RootComponent (since it is added as a result of AttachTo). When RootComponent gets destroyed it tries to detach what it believes to be attached to it, however, since SpringArm has already been detached when character mesh was destroyed it ends up throwing error.

I will look at whether we can be gentler in warning about this scenario rather than assert, but in mean time you are able to fix your own code by setting AttachParent (and AttachSocketName) in ABaseCharacter directly rather than using AttachTo.

In general AttachTo in constructors isn’t safe, I will also be looking at finding a way to warn about that misuse as well.

thanks for followup, this looks promising. I’ll try to fix it on my end and report back

btw you might have noticed BaseCharacter.cpp is just default ThirdPerson character cpp class, so…

In general AttachTo in constructors
isn’t safe, I will also be looking at
finding a way to warn about that
misuse as well.

you guys should really change provided code then, because it is thirdperson template code that comes with AttachTo code in constructor!


apparently your solution works!

I just had to remove this line from my BaseCharacter.cpp:


and functionality is still working since like you mentioned, my child class already handles it like this:

GetCameraBoom()->AttachParent = GetMesh();

it’s all really shady because of what I mention above, but at least it works.