[Replay ~ DemoRec Crash] DemoRecording crashes any time editor-placed character is in the level

Dear Epic,

#Repro

  1. Make a new Third person BP only project
  2. This template starts with a template character already placed in the level
  3. Go in game and open the console and type “Demorec 1”
  4. This crashes the game! (It happens in standalone too for my game,same crash)
  5. This wont crash in standalone for the template project, however I get the same exact crash in standalone / running from commandline for my game. Any time there are placed actors, I get the crash below when starting recording.

Please note this was not an issue in 4.8.0, the engine version I was upgrading from, for this project, and had looots of placed actors that demorec’ed just fine!

:slight_smile:

Rama

#Crash

UE4Editor_Engine!TSet<TPair<TWeakObjectPtr<UObject,FWeakObjectPtr>,TSharedPtr<FRepChangedPropertyTracker,0> >,TDefaultMapKeyFuncs<TWeakObjectPtr<UObject,FWeakObjectPtr>,TSharedPtr<FRepChangedPropertyTracker,0>,0>,FDefaultSetAllocator>::FindId() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\containers\set.h:523]
UE4Editor_Engine!UNetDriver::FindOrCreateRepChangedPropertyTracker() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\networkdriver.cpp:2815]
UE4Editor_Engine!AActor::PreReplication() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\actor.cpp:815]
UE4Editor_Engine!UDemoNetDriver::TickDemoRecord() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\demonetdriver.cpp:992]
UE4Editor_Engine!UDemoNetDriver::TickDispatch() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\demonetdriver.cpp:494]
UE4Editor_Engine!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float)>::ExecuteIfSafe() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:772]
UE4Editor_Engine!TBaseMulticastDelegate<void,float>::Broadcast() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:809]
UE4Editor_Engine!UWorld::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\leveltick.cpp:1062]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\editor\unrealed\private\editorengine.cpp:1347]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\editor\unrealed\private\unrealedengine.cpp:366]
UE4Editor!FEngineLoop::Tick() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launchengineloop.cpp:2428]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launch.cpp:142]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]

Hi Rama -

Thank you for your report. I was able to replicate this issue and it appears that a report is already in place for this issue, UE-19673. I have updated the bug report with your additional information and as soon as I know any additional information I will post back here.

Thank You -

Eric Ketchum

#Thanks Eric!

“I have updated the bug report with your additional information and as soon as I know any additional information I will post back here.”

Thank you Eric!

#:heart:

Rama

#4.10 Update

#I Have Temp Solution and Lots of Info

This crash still occurs in 4.10, however I found a clue for the cause of crash and temp solution.

To review, my crash happens for any character that I spawn during runtime that is spawned with an AI controller.

The crash is occurring in Actor::PreReplication for Characters who are ticking AI.

It is crashing while iterating over all components!

And the ONE component that is causing this crash is:

#GameplayTasksComponent
GameplayTasksComponent

I stopped the replication of this component and now the replay system works without crashing for me!

#Override Of PreReplication To Remove Crash

void AIneff1::PreReplication( IRepChangedPropertyTracker & ChangedPropertyTracker )
{
//~~~ Actor ~~~
if ( bReplicateMovement || AttachmentReplication.AttachParent )
{
	GatherCurrentMovement();
}

DOREPLIFETIME_ACTIVE_OVERRIDE( AActor, ReplicatedMovement, bReplicateMovement );

UBlueprintGeneratedClass* BPClass = Cast<UBlueprintGeneratedClass>(GetClass());
if (BPClass != NULL)
{
	BPClass->InstancePreReplication(ChangedPropertyTracker);
}

// Call PreReplication on all owned components that are replicated
TArray<UActorComponent*> AllComponents;
GetComponents(AllComponents);  
for (UActorComponent* Component : AllComponents)
{
	// Only call on components that aren't pending kill
	if (Component && !Component->IsPendingKill() && Component->GetIsReplicated())
	{        
		UE_LOG(Joy,Error,TEXT("PRE REP COMP %s"), *Component->GetName());  
		//Component->PreReplication(*GetNetDriver()->FindOrCreateRepChangedPropertyTracker(Component).Get());
	}
}

//.. paste the code from Character PreReplication here.

During runtime this code yields “PRE REP COMP GameplayTasksComponent” over and over again as the only component that is running in PreReplication, and is also the comp that crashes the Replay system.

#Summary

The GameplayTasksComponent is running when the Character is spawned with a default controller.

This component is crashing the replay system inside of:

FindOrCreateRepChangedPropertyTracker

#Temp Solution

By not replicating GameplayTasksComponent I can avoid the crash, however because “Net/RepLayout.h” / FRepChangedPropertyTracker is not ENGINE_API I can’t individually pick out and remove just the offending component, which means this solution is really quite a hack because NO replicating components will ever run PreReplication with my current temp solution.

#Request

Please make FRepChangedPropertyTracker ENGINE_API so I can have more refined control over the Actor replication process without having to use a custom engine version!

Thanks!

:slight_smile:

Rama

#Conclusion

GameplayTasksComponent has to be looked at by Epic engineers to figure out why it is crashing the DemoNetDriver.

I cant got any furtehr without FRepChangedPropertyTracker being exported as ENGINE_API (unless I use custom engine build ofc which incurs a lot of wait time)

#:heart:

Rama

Just wanna say thanks so much for finding this out, I just encountered the issue myself and this saves me searching to see if I did something wrong in my own code. Though I’d prefer non-crashing replays cracks whip at Epic