Attachment replication crashes client in 4.5.1

Hi,

I have been at this problem for weeks now and I haven’t gotten one bit closer to a solution. Ever since I upgraded my project to 4.5 it crashes the other clients when another or the server character equips a weapon.

The architecture is rather simple:

  • Client → Equip locally / Call server Equip RPC

  • Equip calls AttachToCharacter which attaches the root component to the character

  • Server Equip changes item state to equipped, item state is replicated to all clients

  • OnReplicated for the state calls AttachToCharacter on all clients:

    void AAdvKitInventory::AttachToCharacter_Implementation()
    {
    AAdvKitCharacter* Character = Cast(Instigator);
    if (RootComponent && Character)
    {
    AttachRootComponentTo(Character->Mesh) , AttachmentSocketName, EAttachLocation::SnapToTarget);
    }
    SetActorHiddenInGame(false);
    }

This worked fine before, but as of 4.5 it crashes with:

[2014.11.14-10.42.16:740][ 79]LogOutputDevice:Warning: 

Script Stack:
Actor.OnRep_AttachmentReplication

Assertion failed: !bRegistered || AttachParent->AttachChildren.Contains(this) [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.5\Engine\Source\Runtime\Engine\Private\SceneComponent.cpp] [Line: 903] 
Attempt to detach SceneComponent 'Default Root' owned by 'BP_Bow_C_1' from AttachParent 'CharacterMesh0' while not attached.
UE4Editor.exe has triggered a breakpoint.

The program '[2328] UE4Editor.exe' has exited with code 0 (0x0).

BP_Bow is the AAdvKitInventory actor that should get equipped. Equipping the item on a client in a one server and one client scenario does not crash and the actor is properly attached.

Additional Information:

Branch: Binary build from the launcher

Build version: 4.5.1 - 2336687

The call stack seems rather useless, but here it is:

KernelBase.dll!000007fefd5d3ca2()	Unknown
UE4Editor-Core.dll!000007fee039cd78()	Unknown
UE4Editor-Core.dll!000007fee036e854()	Unknown
UE4Editor-Engine.dll!000007fede00179c()	Unknown
UE4Editor-Engine.dll!000007feddff855c()	Unknown
UE4Editor-Engine.dll!000007feddb67731()	Unknown
UE4Editor-CoreUObject.dll!000007fee12b6394()	Unknown
UE4Editor-CoreUObject.dll!000007fee138f272()	Unknown
UE4Editor-Engine.dll!000007feddb6be51()	Unknown
UE4Editor-Engine.dll!000007feddffc191()	Unknown
UE4Editor-Engine.dll!000007feddcc3bba()	Unknown
UE4Editor-Engine.dll!000007feddcc68de()	Unknown
UE4Editor-Engine.dll!000007feddccbf90()	Unknown
UE4Editor-Engine.dll!000007feddcce12f()	Unknown
UE4Editor-Engine.dll!000007feddccdc8b()	Unknown
UE4Editor-Engine.dll!000007feddccdf43()	Unknown
UE4Editor-Engine.dll!000007feddf750c7()	Unknown
UE4Editor-Engine.dll!000007feddf755da()	Unknown
UE4Editor-OnlineSubsystemUtils.dll!000007fed7ca3b2c()	Unknown
UE4Editor-Engine.dll!000007feddf48037()	Unknown
UE4Editor-Engine.dll!000007fedda7be14()	Unknown
UE4Editor-Engine.dll!000007feddf0b651()	Unknown
UE4Editor-UnrealEd.dll!000007fedbb2ebb2()	Unknown
UE4Editor-UnrealEd.dll!000007fedbf8f966()	Unknown
UE4Editor.exe!FEngineLoop::Tick() Line 2129	C++
UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 133	C++
UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 190	C++
[External Code]

Yeah attachment has been quite a pain for me as well. Let’s say I attach a blueprint to something that’s supposed to move in the environment, a client interacts with it, launches an interface speaking to that blueprint (run on server) but the item that’s attached is marked as being… “not valid”. If it’s not attached then… gameplay logic runs perfectly.

I am using 4.7 preview now and it still crashes and has crashed through the 4.6 life cycle. I am getting the feeling that I am doing something wrong, but I just cannot figure out what.

Hello FTC,

i’m experiencing the Same problem at the current Moment i will back to you if i found a solution during this week

Any news on that? Because I have struggled with this for days now… https://answers.unrealengine.com/questions/185009/attachrootcomponenttoactor-crashes-game.html

Any progress with this issue? I am running into the same problem.