GC FSM - Event-driven, hierarchical finite state machines in blueprint

Hi there,

We’re having an issue in a COOKED 4.24 build.
4.24 Cooked Build.
After a few seconds the build crashes.
What can we do to help debug / fix this?


  
 Assertion failed: !IsUnreachable() [File:D:/UnrealEngine/Engine/Source/Runtime/CoreUObject/Private/UObject/ScriptCore.cpp] [Line: 1750] GCFSMRootState /Game/Codename/Maps/Menu/Menu_Home_BP.Menu_Home_BP:PersistentLevel.BP_Char_Slate_C_2147482413.BP_CharacterGlow_Component.GCFSMRootState_2147482397 Function: '/Script/GCFSM.GCFSMState:OnTick'Codename!AssertFailedImplV() [D:\UnrealEngine\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:105] Codename!FDebug::CheckVerifyFailedImpl() [D:\UnrealEngine\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:455] Codename!DispatchCheckVerify<void,<lambda_7a7891a52445f6ae2f3f856d3ad505aa> >() [D:\UnrealEngine\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:167] Codename!UObject::ProcessEvent() [D:\UnrealEngine\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1750] Codename!UGCFSMState::Tick() [D:\builds\424\cpg\gf-testing-deploy-424\Plugins\GCFSM\Source\Runtime\Classes\GCFSMState.h:112] Codename!UGCFSMState::PrivateTick() [D:\builds\424\cpg\gf-testing-deploy-424\Plugins\GCFSM\Source\Runtime\Private\GCFSMState.cpp:125] Codename!FTickableGameObject::TickObjects() [D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\Tickable.cpp:139] Codename!UWorld::Tick() [D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1622] Codename!UGameEngine::Tick() [D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1666] Codename!FEngineLoop::Tick() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4485] Codename!GuardedMain() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\Launch.cpp:173] Codename!GuardedMainWrapper() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:134] Codename!WinMain() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:263] Codename!__scrt_common_main_seh() [d:\agent\_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288] kernel32 ntdll 

Assertion failed: !IsUnreachable() [File:/UnrealEngine/Engine/Source/Runtime/CoreUObject/Private/UObject/ScriptCore.cpp] [Line: 1750] GCFSMRootState /Game/Codename/Maps/Menu/Menu_Home_BP.Menu_Home_BP:PersistentLevel.BP_Char_Slate_C_2147482413.BP_CharacterGlow_Component.GCFSMRootState_2147482397 Function: '/Script/GCFSM.GCFSMState:OnTick’Codename!AssertFailedImplV() [D:\UnrealEngine\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:105] Codename!FDebug::CheckVerifyFailedImpl() [D:\UnrealEngine\Engine\Source\Runtime\Core\Private\Misc\AssertionMacros.cpp:455] Codename!DispatchCheckVerify<void,<lambda_7a7891a52445f6ae2f3f856d3ad505aa> >() [D:\UnrealEngine\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:167] Codename!UObject::ProcessEvent() [D:\UnrealEngine\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1750] Codename!UGCFSMState::Tick() [D:\builds\424\cpg\gf-testing-deploy-424\Plugins\GCFSM\Source\Runtime\Classes\GCFSMState.h:112] Codename!UGCFSMState::PrivateTick() [D:\builds\424\cpg\gf-testing-deploy-424\Plugins\GCFSM\Source\Runtime\Private\GCFSMState.cpp:125] Codename!FTickableGameObject::TickObjects() [D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\Tickable.cpp:139] Codename!UWorld::Tick() [D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1622] Codename!UGameEngine::Tick() [D:\UnrealEngine\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1666] Codename!FEngineLoop::Tick() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4485] Codename!GuardedMain() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\Launch.cpp:173] Codename!GuardedMainWrapper() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:134] Codename!WinMain() [D:\UnrealEngine\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:263] Codename!__scrt_common_main_seh() [d:\agent_work\5\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288] kernel32 ntdll

Hi @eanticev, I just invited you to the Slack channel, so we can discuss your issue there. I am currently out of office and I don’t have the code to double check, but it seems that an FSM is ticking but its context object has been released by the garbage collector. I will look further into the issue as soon as I am back. As a stopgap measure, you can try replacing the offending Assert you should find at GCFSMState.h:112 with a


if(IsUnreachable()) return;

.

I have this issue too! @gamecentric I can’t find anythind resembling an assert at GCFSMState.h:112, please elaborate

@staskjs I have sent a patch to @eanticev on Slack, but I didn’t receive confirmation if it actually fixes the issue. I will send you a PM with the patch so you can check it. As for the assert, you can’t find it at GCFSMState.h:112 because it has been inlined by the compiler. It’s actually called by the automatically-generated function OnTick().

I am also getting an “Object is not running FSMs” error from time to time, I can’t figure out where it is coming from. I have even wrapped all "Trigger FSM Event"s with “Is FSM running”, but I still get this error. Could you please explain what it actually means and how it gets triggered?
Also there is probably a bug with fsm replication on a cooked build, as if it goes out of sync, but I am not sure. Sometimes it seems that fsm on server just stops working suddenly, without calling “on Exit”, but client fsm continues to work, but it never goes to the next state, because server becomes broken. It seems to be connected to this “Object is not running FSMs” error. If I try to trigger an event from client (where fsm is running), server shows this error (while fsm is not running on server)

Everything works just fine in the editor.

I also could say, that there wasn’t any problems on 4.23, it all started at 4.24 version.

I’m also starting to run into the issue of the FSM stopping to work on my object but I’m not sure how to debug it properly. The output Log error I get is this -


LogGCFSM: Warning: Event FindTarget not triggered

What would cause an issue like this? I’ve been trying to fix it on my end but any help would be super appreciated.

I found the source of the regression that is causing bugs. This include the following cases:

  1. An FSM unexpectedly stops ticking
  2. “Event X not triggered” messages (that’s because the target FSM has stopped, see point 1)
  3. “Assertion failed: !IsUnreachable()”

I am testing a fix right now and I’m confident I can submit it today. FIY, the problems are triggered by changes in the garbage collection implemented in Unreal 4.24 I was unaware of. Those changes introduced a race condition in the GCFSM code, producing false answers to the question “is the context object of this FSM still reachable”? The code I was using was therefore induced to believe the context object was unreachable when it wasn’t, thus stopping the FSM prematurely and causing 1 and 2, or induced to believed the context was still reachable when it wasn’t, thus keeping the FSM ticking on an unreachable object and causing 3.

The fix was submitted. I’ll post here when it’s online. Thanks everyone for your patience.

Seems to be working now! Thank you for quick fix!

Indeed, it went online quicker than I expected! So quick I had missed the notification from Epic and forgot to post here… :o Glad to hear that it works! Thanks to everyone for the reports.
Just a note, please expect another minor fix this week. It seems that a non-critical, but very annoying, issue previously reported by @Ghar has regressed. I already have a fix for that and will submit it soon.

Thank you so much for the fix @gamecentric ! I’ve really been enjoying your plugin, it’s made prototyping much faster!

Hi, the upcoming Unreal Engine 4.25 introduces a few API breaking changes. Nothing serious, but a few editor classes have been renamed, so the old code will no longer compile as-is. I am monitoring the situation and will publish a UE 4.25 version of GC FSM when the new editor version is officially released. However, for the brave of you that are already experimenting with the new engine and are able to to build the plugin from the sources, I have just pushed a new version, dubbed v1.7.5, of GC FSM. This version includes the necessary UE 4.25 compatibility fixes and no new features or bugfixes.
Enjoy!

Engine version UE 4.24
Plugin version 1.7.4
Hello. I have some issue in build. In Editor mode all work clear.



 === Critical error: === Assertion failed: contextObjectPtr [File:/Plugins/GCFSM/Source/Runtime/Private/GCFSMState.cpp] [Line: 53]  
[Callstack] 0x00007ffec020a388 KERNELBASE.dll!UnknownFunction ]  
[Callstack] 0x00007ff72d61bf76 MyProject.exe!ReportAssert() ]  
[Callstack] 0x00007ff72d61f878 MyProject.exe!FWindowsErrorOutputDevice::Serialize() ]  
[Callstack] 0x00007ff72d3f630d MyProject.exe!FOutputDevice::LogfImpl() ]  
[Callstack] 0x00007ff72d386a07 MyProject.exe!FDebug::AssertFailed() ]  
[Callstack] 0x00007ff72d388ec0 MyProject.exe!FDebug::CheckVerifyFailedImpl() ]  
[Callstack] 0x00007ff72c842488 MyProject.exe!UGCFSMState::Initialize() \plugins\gcfsm\source\runtime\private\gcfsmstate.cpp:53]  
[Callstack] 0x00007ff72c844a34 MyProject.exe!UGCFSMState::MakeStateObject() \plugins\gcfsm\source\runtime\private\gcfsmstate.cpp:38]  
[Callstack] 0x00007ff72c84f904 MyProject.exe!UGCFSMState::execMakeStateObject() \plugins\gcfsm\source\runtime\classes\gcfsmstate.h:47]  
[Callstack] 0x00007ff72d92e33f MyProject.exe!UObject::execCallMathFunction() ]  
[Callstack] 0x00007ff72d93098a MyProject.exe!UObject::execLetObj() ]
[Callstack] 0x00007ff72d90cef2 MyProject.exe!ProcessLocalScriptFunction() ]  
[Callstack] 0x00007ff72d8e0a6a MyProject.exe!ProcessScriptFunction<void (__cdecl*)(UObject * __ptr64,FFrame & __ptr64,void * __ptr64)>() ]  
[Callstack] 0x00007ff72d90caff MyProject.exe!ProcessLocalFunction() ]  
[Callstack] 0x00007ff72d90cef2 MyProject.exe!ProcessLocalScriptFunction() ]  
[Callstack] 0x00007ff72d90c771 MyProject.exe!UObject::ProcessInternal() ]  
[Callstack] 0x00007ff72d705ba9 MyProject.exe!UFunction::Invoke() ]  
[Callstack] 0x00007ff72d90c297 MyProject.exe!UObject::ProcessEvent() ]  
[Callstack] 0x00007ff72c842c9c MyProject.exe!UGCFSM::InvokeEntryPoint() \plugins\gcfsm\source\runtime\private\gcfsm.cpp:290]  
[Callstack] 0x00007ff72c8431d4 MyProject.exe!UGCFSMState::LaunchFSM() \plugins\gcfsm\source\runtime\private\gcfsmstate.cpp:223]  
[Callstack] 0x00007ff72c843363 MyProject.exe!UGCFSMUtilities::LaunchFSM() \plugins\gcfsm\source\runtime\private\gcfsmutilities.cpp:203]  
[Callstack] 0x00007ff72c84f2a3 MyProject.exe!UGCFSMUtilities::execLaunchFSM() \plugins\gcfsm\source\runtime\classes\gcfsmutilities.h:14]  
[Callstack] 0x00007ff72d92e33f MyProject.exe!UObject::execCallMathFunction() ]  
[Callstack] 0x00007ff72d90cef2 MyProject.exe!ProcessLocalScriptFunction() ]  
[Callstack] 0x00007ff72d90c771 MyProject.exe!UObject::ProcessInternal() ]  
[Callstack] 0x00007ff72d705ba9 MyProject.exe!UFunction::Invoke() ]  
[Callstack] 0x00007ff72d90c297 MyProject.exe!UObject::ProcessEvent() ]
[Callstack] 0x00007ff72fd66fee MyProject.exe!FLatentActionManager::TickLatentActionForObject() ]  
[Callstack] 0x00007ff72fd4d24f MyProject.exe!FLatentActionManager::ProcessLatentActions() ]  
[Callstack] 0x00007ff72fd641b8 MyProject.exe!UWorld::Tick() ]  
[Callstack] 0x00007ff72fbde513 MyProject.exe!UGameEngine::Tick() ]  
[Callstack] 0x00007ff72c561bab MyProject.exe!FEngineLoop::Tick() ]  
[Callstack] 0x00007ff72c57407c MyProject.exe!GuardedMain() ]  
[Callstack] 0x00007ff72c57413a MyProject.exe!GuardedMainWrapper() ]  
[Callstack] 0x00007ff72c58456f MyProject.exe!WinMain() ]  
[Callstack] 0x00007ff731587e02 MyProject.exe!__scrt_common_main_seh() [d:\agent\_work\2\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
[Callstack] 0x00007ffec0de4034 KERNEL32.DLL!UnknownFunction ]
[Callstack] 0x00007ffec3043691 ntdll.dll!UnknownFunction ] 

It’s happen after return from game level to menu level.

Hi @Archizeff, it’s hard to tell without seeing the project… However I can make some guesses. It seems there is a call to LaunchFSM being performed by a latent function on an object that is going to be destroyed soon. Could you at least share the blueprint that is calling LaunchFSM? If you don’t feel like posting it in the forum, please request an invitation on the dedicated slack channel.

Hi, any chance we could get a 4.25 version sometime soon?

A version targeting UE 4.25 has already been submitted to Epic. It should be available on the marketplace early next week.

It took a bit longer than expected, but I just received notification that the new version targeting UE 4.25 is now available.

Ugh - very irritating, I can select 4.25 when attempting to install, but hitting “Install” does nothing. Installing to 4.24 works fine…I’m guessing this is a problem on Epic’s end.

We’re having the same issue installing from Epic Launcher for 4.25.

We tried on another PC and we’re getting a message “no compatible engines installed” even though 4.25 is installed.

Is there any way to get the 4.25 plugin outside epic?

Still waiting for a fix on this. Can’t install to 4.25 via the Launcher.