# Access violation in UpdateChangelistMgr

**URL:** <https://forums.unrealengine.com/t/access-violation-in-updatechangelistmgr/476115>\
**Category:** Community & Industry Discussion\
**Tags:** uobject, Replication, access-violation, unreal-engine, question\
**Created:** [December 24, 2020, 7:59pm UTC](https://forums.unrealengine.com/t/access-violation-in-updatechangelistmgr/476115 "2020-12-24T19:59:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Fronit](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Fronit](https://forums.unrealengine.com/u/Fronit)\
**Post date:** [December 24, 2020, 7:59pm UTC](https://forums.unrealengine.com/t/access-violation-in-updatechangelistmgr/476115/1 "2020-12-24T19:59:46Z")

</div>

Hello,

I am having troubles with an access violation in UpdateChangelistMgr sometimes right after i add an UObject to an replicated array. I am running out of ideas so any help would be awesome.

**The error:**

Unhandled Exception: EXCEPTION\_ACCESS\_VIOLATION reading address 0xfffffdba97390f14

```
// See if we can re-use the work already done on a previous connection
 1204 // Rules:
 1205 //	1. We always compare once per frame (i.e. check LastReplicationFrame == ReplicationFrame)
 1206 //	2. We check LastCompareIndex &gt; 1 so we can do at least one pass per connection to compare all properties
 1207 // This is necessary due to how RemoteRole is manipulated per connection, so we need to give all connections a chance to see if it changed
 1208 //	3. We ALWAYS compare on bNetInitial to make sure we have a fresh changelist of net initial properties in this case
 1209 ***** if (!bForceCompare &amp;&amp; GShareShadowState &amp;&amp; !RepFlags.bNetInitial &amp;&amp; RepState-&gt;LastCompareIndex &gt; 1 &amp;&amp; InChangelistMgr.LastReplicationFrame

```

**Stacktrace**

```
UE4Editor_Engine!FRepLayout::UpdateChangelistMgr() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\RepLayout.cpp:1210]
UE4Editor_Engine!FObjectReplicator::ReplicateProperties() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\DataReplication.cpp:1614]
UE4Editor_Engine!UActorChannel::ReplicateActor() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:3173]
UE4Editor_Engine!UNetDriver::ServerReplicateActors_ProcessPrioritizedActors() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:4471]
UE4Editor_Engine!UNetDriver::ServerReplicateActors() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:4874]
UE4Editor_Engine!UNetDriver::TickFlush() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:600]
UE4Editor_Engine!TBaseUObjectMethodDelegateInstance&lt;0,UNetDriver,void __cdecl(float),FDefaultDelegateUserPolicy&gt;::ExecuteIfSafe() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:611]
UE4Editor_Engine!TMulticastDelegate&lt;void __cdecl(float),FDefaultDelegateUserPolicy&gt;::Broadcast() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:955]
UE4Editor_Engine!UWorld::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1619]
UE4Editor_Engine!UGameEngine::Tick() [D:\Build\++UE4\Sync\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1767]

```

**My setup:**

**Inventory : UActorComponent**

```
UPROPERTY(ReplicatedUsing=OnRep_Items, BlueprintReadOnly, VisibleAnywhere)
	TArray<UItemData*> Items;

virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override {
		Super::GetLifetimeReplicatedProps(OutLifetimeProps);
		DOREPLIFETIME(UInventory, Items);
	}

	virtual bool ReplicateSubobjects(UActorChannel* Channel, FOutBunch* Bunch, FReplicationFlags* RepFlags) override {
		check(Channel && Bunch && RepFlags);
		bool bWroteSomething = Super::ReplicateSubobjects(Channel, Bunch, RepFlags);
		bWroteSomething |= Channel->ReplicateSubobjectList(Items, *Bunch, *RepFlags);
		return bWroteSomething;
	}

```

**UItemData : UObject**

```
 virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override {
        Super::GetLifetimeReplicatedProps(OutLifetimeProps);

        if (const UBlueprintGeneratedClass* BPClass = Cast<UBlueprintGeneratedClass>(GetClass())) {
            BPClass->GetLifetimeBlueprintReplicationList(OutLifetimeProps);
        }

        DOREPLIFETIME(UItemData, PersistentItemId);
        DOREPLIFETIME(UItemData, Quantity);
        DOREPLIFETIME(UItemData, SpawnedActor);
        DOREPLIFETIME(UItemData, SlotIndex);
        DOREPLIFETIME(UItemData, ItemMetadata);
    }

    virtual bool IsSupportedForNetworking() const override {
        return true;
    }

```

**The call to add items**

```
void SomeMethod(){
      UItemData* item = NewObject<UItemData>(lOwner)->SetData(createdItem.Get()->Id, createdItem.Get()->Quantity, createdItem.Get()->ItemActorId, createdItem.Get()->SlotIndex, itemMetadata);
                inventory->Server_AddItem(item);
}

bool UInventory::Server_AddItem(UItemData* item) {
    Items.Add(item);
    return true;
}

```

Any idea what might cause the crash?

---

<div class="post-metadata">

**Author:** ![Richard.Sumo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Richard.Sumo](https://forums.unrealengine.com/u/Richard.Sumo)\
**Post date:** [April 9, 2021, 11:42am UTC](https://forums.unrealengine.com/t/access-violation-in-updatechangelistmgr/476115/2 "2021-04-09T11:42:32Z")

</div>

Hiya,  
Did you ever get to the bottom of this. Seeing a very similar callstack.

---

<div class="post-metadata">

**Author:** ![boyty01](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@boyty01](https://forums.unrealengine.com/u/boyty01)\
**Post date:** [May 7, 2022, 11:03am UTC](https://forums.unrealengine.com/t/access-violation-in-updatechangelistmgr/476115/3 "2022-05-07T11:03:56Z")

</div>

I’m having similar trouble here. I have an array of UObjects that are setup to replicate. Functionality works fine across most of the logic except when I try and run logic off the back of the OnRep\_ function it crashes with a violation on the line that tries to access any property of an element (UObject) of the array.
