Crash in UConvaiChatbotComponent::onResponseDataReceived when replicated

The function crashes when working in a networked context. This is the call stack:

Assertion failed: IsInGameThread() [File:D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp] [Line: 7444] Attempted to call ProcessRemoteFunction from a thread other than the game thread, which is not supported. Object: /Game/UEDPIE_0_Main.Main:PersistentLevel.BP_Seneca_C_UAID_DC46284EE88BA29302_1631357241.ConvaiChatbot Function: Broadcast_onResponseDataReceived
UnrealEditor_Engine!UNetDriver::ProcessRemoteFunction() [D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\NetDriver.cpp:7444]
UnrealEditor_Engine!UActorComponent::CallRemoteFunction() [D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\Components\ActorComponent.cpp:837]
UnrealEditor_CoreUObject!UObject::ProcessEvent() [D:\build++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:2010]
UnrealEditor_Convai!UConvaiChatbotComponent::Broadcast_onResponseDataReceived() [d:\build\U5M\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ConvAI\Intermediate\Build\Win64\UnrealEditor\Inc\Convai\UHT\ConvaiChatbotComponent.gen.cpp:1136]
UnrealEditor_Convai!UConvaiChatbotComponent::onResponseDataReceived() [D:\build\U5M\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ConvAI\Source\Convai\Private\ConvaiChatbotComponent.cpp:852]
UnrealEditor_Convai!TBaseUObjectMethodDelegateInstance<0,UConvaiChatbotComponent,void __cdecl(FString,TArray<unsigned char,TSizedDefaultAllocator<32> > const &,unsigned int,bool),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\RocketSync\5.4.0-33043543+++UE5+Release-5.4\Working\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:665]
UnrealEditor_Convai!FThreadSafeDelegateWrapper<TDelegate<void __cdecl(FString,TArray<unsigned char,TSizedDefaultAllocator<32> > const &,unsigned int,bool),FDefaultDelegateUserPolicy> >::ExecuteIfBound<FString &,TArray<unsigned char,TSizedDefaultAllocator<32>() [D:\build\U5M\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ConvAI\Source\Convai\Public\ConvaiDefinitions.h:989]
UnrealEditor_Convai!UConvaiGRPCGetResponseProxy::OnStreamRead() [D:\build\U5M\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ConvAI\Source\Convai\Private\ConvaiGRPC.cpp:890]
UnrealEditor_Convai!TBaseUObjectMethodDelegateInstance<0,UConvaiGRPCGetResponseProxy,void __cdecl(bool),FDefaultDelegateUserPolicy>::ExecuteIfSafe() [D:\RocketSync\5.4.0-33043543+++UE5+Release-5.4\Working\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:667]
UnrealEditor_Convai!FgRPCClient::Run() [D:\build\U5M\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ConvAI\Source\Convai\Private\ConvaiSubsystem.cpp:213]
UnrealEditor_Core!FRunnableThreadWin::Run() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Windows\WindowsRunnableThread.cpp:149]

This is expected because the onResponseDataReceived callback is triggered from a gRPC context which is not running on the game thread, and it is illegal to call remote functions from a thread other than the game thread.

The call to Broadcast_onResponseDataReceived should be wrapped in an AsyncTask lambda that transfers it to the game thread and not called directly from the gRPC thread.

How is networking working for anyone?

I see that this is fixed in 3.6.7. I wasn’t aware there’s a newer version because what’s on Fab/Marketplace is 3.6.0.

1 Like