Infinite loop in FAnimMontageInstance::Advance

I hit an infinite loop in FAnimMontageInstance::Advance while following the 3rd Person Game with Blueprints tutorial.

I was changing the “Montage Tick Type” to “Branching Point” (see 13m32s in video) and the editor stopped responding. I changed my second Notify first (the video changes the first one first). A second or so after I changed the first notify to “Branching Point”, the editor stopped responding (probably the delay is because the animation was looping and it wasn’t until it hit the branch point?).

It looks like the issue doesn’t occur if the animation preview is not playing.

FAnimMontageInstance::Advance never exits. It gets the PosInSection from GetAnimCompositeSectionIndexFromPos and passes it to AdvanceTime where it is incremented and then clamped back to EndTime. AdvanceTime ETAA_Finished, but we don’t do anything with that (BranchingPointMarker is true).

Changing ActualDeltaMove to 1 broke me out of the loop and revived my editor long enough to pause the animation. I was able to reproduce this by undoing both “Montage Tick Type” settings and only changing the first notify.

Some variables for context:

	at line 1350 > float PrevPosition = Position;
	PosInSection	0.307029426	float
	DesiredDeltaMove	0.000271957368	float
	ActualDeltaPos	0.000000000	const float
	Position	0.478457987	float

	at line 1416 > if ((AdvanceType != ETAA_Default) && !BranchingPointMarker && (PositionBeforeFiringEvents == Position))
	AdvanceType != ETAA_Default	true	bool
	!BranchingPointMarker	false	bool
	PositionBeforeFiringEvents == Position	identifier "PositionBeforeFiringEvents" is undefined	
	AdvanceType	ETAA_Finished (0x00000001)	ETypeAdvanceAnim
	PositionBeforeFiringEvents	identifier "PositionBeforeFiringEvents" is undefined	
	Position	0.478457987	float

Here’s the flow of values for PosInSection and InOutTime (same memory):

GetAnimCompositeSectionIndexFromPos: PosInSection=0.307029426
Enter function FAnimationRuntime::AdvanceTime: MoveDelta=0.000271957368 InOutTime=0.307029426
check bAllowLooping in FAnimationRuntime::AdvanceTime: MoveDelta=0.000271957368 InOutTime=0.307301372
Clamp in FAnimationRuntime::AdvanceTime: MoveDelta=0.000271957368 InOutTime=0.307301372
after returning from AdvanceTime: PosInSection=0.307029426

Callstack:

>	UE4Editor-Engine.dll!FAnimationRuntime::AdvanceTime(const bool & bAllowLooping, const float & MoveDelta, float & InOutTime, const float & EndTime) Line 537	C++
	UE4Editor-Engine.dll!FAnimMontageInstance::Advance(float DeltaTime, FRootMotionMovementParams * OutRootMotionParams, bool bBlendRootMotion) Line 1342	C++
	UE4Editor-Engine.dll!UAnimInstance::Montage_Advance(float DeltaSeconds) Line 1696	C++
	UE4Editor-Engine.dll!UAnimSingleNodeInstance::Montage_Advance(float DeltaTime) Line 431	C++
	UE4Editor-Engine.dll!UAnimInstance::UpdateAnimation(float DeltaSeconds) Line 425	C++
	UE4Editor-Engine.dll!USkeletalMeshComponent::TickAnimation(float DeltaTime) Line 509	C++
	UE4Editor-Engine.dll!USkeletalMeshComponent::TickPose(float DeltaTime, bool bNeedsValidRootMotion) Line 618	C++
	UE4Editor-Engine.dll!USkinnedMeshComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) Line 451	C++
	UE4Editor-Engine.dll!USkeletalMeshComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) Line 630	C++
	UE4Editor-UnrealEd.dll!UDebugSkelMeshComponent::TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) Line 728	C++
	UE4Editor-Engine.dll!UActorComponent::ConditionalTickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction & ThisTickFunction) Line 1137	C++
	UE4Editor-Engine.dll!FActorComponentTickFunction::ExecuteTick(float DeltaTime, ELevelTick TickType, ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 677	C++
	UE4Editor-Engine.dll!FTickFunctionTask::DoTask(ENamedThreads::Type CurrentThread, const TRefCountPtr<FGraphEvent> & MyCompletionGraphEvent) Line 141	C++
	UE4Editor-Engine.dll!TGraphTask<FTickFunctionTask>::ExecuteTask(TArray<FBaseGraphTask *,FDefaultAllocator> & NewTasks, ENamedThreads::Type CurrentThread) Line 779	C++
	UE4Editor-Core.dll!FTaskThread::ProcessTasks(int QueueIndex, bool bAllowStall) Line 539	C++
	UE4Editor-Core.dll!FTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 340	C++
	UE4Editor-Core.dll!FTaskGraphImplementation::WaitUntilTasksComplete(const TArray<TRefCountPtr<FGraphEvent>,TInlineAllocator<4,FDefaultAllocator> > & Tasks, ENamedThreads::Type CurrentThreadIfKnown) Line 1140	C++
	UE4Editor-Engine.dll!FTaskGraphInterface::WaitUntilTaskCompletes(const TRefCountPtr<FGraphEvent> & Task, ENamedThreads::Type CurrentThreadIfKnown) Line 212	C++
	UE4Editor-Engine.dll!FTickTaskSequencer::ReleaseTickGroup(ETickingGroup WorldTickGroup, bool bBlockTillComplete) Line 292	C++
	UE4Editor-Engine.dll!FTickTaskManager::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 1206	C++
	UE4Editor-Engine.dll!UWorld::RunTickGroup(ETickingGroup Group, bool bBlockTillComplete) Line 701	C++
	UE4Editor-Engine.dll!UWorld::Tick(ELevelTick TickType, float DeltaSeconds) Line 1150	C++
	UE4Editor-Persona.dll!FAnimationViewportClient::Tick(float DeltaSeconds) Line 752	C++
	UE4Editor-UnrealEd.dll!UEditorEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 1407	C++
	UE4Editor-UnrealEd.dll!UUnrealEdEngine::Tick(float DeltaSeconds, bool bIdleMode) Line 366	C++
	UE4Editor.exe!FEngineLoop::Tick() Line 2428	C++
	UE4Editor.exe!GuardedMain(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 142	C++
	UE4Editor.exe!GuardedMainWrapper(const wchar_t * CmdLine, HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, int nCmdShow) Line 126	C++
	UE4Editor.exe!WinMain(HINSTANCE__ * hInInstance, HINSTANCE__ * hPrevInstance, char * __formal, int nCmdShow) Line 200	C++
	UE4Editor.exe!__tmainCRTStartup() Line 618	C
	kernel32.dll!00007ffe349613d2()	Unknown
	ntdll.dll!00007ffe36d15454()	Unknown

Version: 4.9.0-0+++depot+UE4-Releases+4.9

Hi idbrii,

I was not able to replicate this here. Does this persist in 4.9.1. Have you tried going back through the previous steps, comparing them to the tutorial to be ensure you did not make an error earlier that causes a conflict when creating the new Branching Points?

Hi idbrii,

We have not heard back from you in a while so I am closing this thread for tracking purposes. If you are still experiencing this problem, please respond with the requested information and we will continue to investigate the issue.

Thanks