AttachParent / AttachChild Replication Race Condition
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.
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.
Follow this question
Once you sign in you will be able to subscribe for any updates here