Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

AttachParent / AttachChild Replication Race Condition

Hey Epic,

I know there have been issues in the past with how AttachParent and AttachChildren replication are handled (they're non-atomic), but it's causing huge headaches for us because we have optimized our net update frequencies in such a way that has resulted in the parent's replication always occurring before the child's replication.

Therefore we get stuck in a state where, upon detaching (and I presume attaching) the child, the AttachParent is stale and the AttachChildren reflects the new list for the clients. There are lots of replication flows that rely on these being in sync and throw hitch-causing ensures. The easiest repro case I can show you is in the most UE4.14.2 vanilla, when a replicated actor attempts to SyncReplicatedPhysicsSimulation in PostNetReceive while it still has a stale AttachParent.

The ensure seems to be benign since it occurs in DetachComponent, which actually promptly puts it in a safe state, but I don't think that was the intended use of that function given the existence of the ensure. I've temporarily changed the ensure to a log in our version of UE4 to get rid of the hitch, but I'd love to know if there is any intention of making the replication of attachment atomic or at least have it gracefully handle replication occurring in this order.

I've attached a very simple project that you should be able to use to reproduce the issue simply by playing in dedicated server and then waiting around 10 seconds for the delay and subsequent latent replication to occur.

Super Simple Repro Case

There's just the one BeginPlay event in AttachParent, and then the most notable properties are the Net Update Frequencies in both AttachParent and AttachChild.

Cheers, Rob

Product Version: UE 4.14
more ▼

asked Jan 04 '17 at 09:23 PM in Bug Reports

avatar image

31 2 3 5

avatar image Miheev2 Oct 15 '17 at 03:21 AM

The problem still exists. I also met her, at the first Dets there is !bRegistered.

avatar image Sean L ♦♦ STAFF Oct 17 '17 at 01:57 PM

Thanks for letting us know, I've gone ahead and reopened the issue for investigation.

avatar image Paul Ripley Jun 28 '18 at 04:01 PM

we have hit this check a few times, and it seems to be on the clients where attaching/detaching has been replicated. I can't confirm yet, but I suspect this might be the problem. For clarification, I mean the check mentioned in https://issues.unrealengine.com/issue/UE-40244, which links back to here.

avatar image Paul Ripley Jun 28 '18 at 04:33 PM

Just got a callstack :

It's the same as the one if the associated issue :

  UE4Editor-Engine.dll!USceneComponent::DetachFromComponent(const FDetachmentTransformRules & DetachmentRules) Line 2009  C++
     UE4Editor-Engine.dll!AActor::OnRep_AttachmentReplication() Line 1536    C++
     UE4Editor-CoreUObject.dll!UFunction::Invoke(UObject * Obj, FFrame & Stack, void * const Z_Param__Result) Line 4551  C++
     UE4Editor-CoreUObject.dll!UObject::ProcessEvent(UFunction * Function, void * Parms) Line 1345   C++
     UE4Editor-Engine.dll!AActor::ProcessEvent(UFunction * Function, void * Parameters) Line 687 C++
     UE4Editor-Engine.dll!FRepLayout::CallRepNotifies(FRepState * RepState, UObject * Object) Line 2404  C++
     UE4Editor-Engine.dll!FObjectReplicator::CallRepNotifies(bool bSkipIfChannelHasQueuedBunches) Line 1487  C++
     UE4Editor-Engine.dll!FObjectReplicator::PostReceivedBunch() Line 1043   C++
     UE4Editor-Engine.dll!UActorChannel::ProcessBunch(FInBunch & Bunch) Line 2313    C++
     UE4Editor-Engine.dll!UActorChannel::ReceivedBunch(FInBunch & Bunch) Line 2148   C++
     UE4Editor-Engine.dll!UChannel::ReceivedSequencedBunch(FInBunch & Bunch) Line 296    C++
     UE4Editor-Engine.dll!UChannel::ReceivedNextBunch(FInBunch & Bunch, bool & bOutSkipAck) Line 667 C++
     UE4Editor-Engine.dll!UChannel::ReceivedRawBunch(FInBunch & Bunch, bool & bOutSkipAck) Line 388  C++
     UE4Editor-Engine.dll!UNetConnection::ReceivedPacket(FBitReader & Reader) Line 1540  C++
     UE4Editor-Engine.dll!UNetConnection::ReceivedRawPacket(void * InData, int Count) Line 933   C++
(comments are locked)
10|2000 characters needed characters left
Viewable by all users

2 answers: sort voted first

Hey BobbyTOutpost,

I've reproduced your issue and have entered a bug report, which you can track using the link below:


Thanks for your report.

Have a great day

more ▼

answered Jan 05 '17 at 06:57 PM

avatar image

Sean L ♦♦ STAFF
43.6k 485 152 442

avatar image BobbyTOutpost Jan 05 '17 at 11:05 PM

Thanks Sean!

avatar image Paul Ripley Jun 29 '18 at 09:18 AM

The linked bug has the same callstack described here : https://answers.unrealengine.com/questions/185009/attachrootcomponenttoactor-crashes-game.html

It's not clear if that problem was ever resolved. I am still getting this problem in 4.19 however.

avatar image Sean L ♦♦ STAFF Jul 02 '18 at 01:58 PM

Hi Paul,

This issue has not been resolved at this time. We don't have a timeframe for when this may be addressed. Please keep in mind that with source code access, a programmer on your project can implement your own solution, and you are welcome to share that result with Epic for possible integration.



(comments are locked)
10|2000 characters needed characters left
Viewable by all users

Fix in 4.20 REALLY? WHY? It happens in UE 4.17 too

more ▼

answered Jan 21 '18 at 12:15 PM

avatar image

47 7 10

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question