Crashes in ProcessEvent (ScriptCore.cpp:1912)

Hello,

My online game has been plagued by crashes that all occur in the same spot in ScriptCore.cpp (line 1912), though the crashes seem to sometimes take different paths to get there. I have no clue how to replicate the crashes. They occur mostly (though not always) on the (non-dedicated) server, but can occur on clients too. They seem to happen usually as a result of an RPC, but other than that, generally happen at random (it will often be an RPC that worked 100’s of times before that match, and often not the same one).

My project uses C++ for most of the player logic. The C++ class makes use of RPCs and replicated variables. It seemed considerably more unstable before I switched away from using replicated pointers, but even though I now pass IDs around instead of pointers, I still get the occasional crash.

Here are two of the crashes I’ve seen on the server (server player, not dedicated server). Note this one only references native UE4 code:

LoginId:cb7315ea465f4d48a6e2f5b4cdb74ce8
EpicAccountId:7f8b5118ebf549a6be00f95e4de9d185
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000260
MeleePowerFantasy!UObject::ProcessEvent() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1912]
MeleePowerFantasy!AActor::ProcessEvent() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\Actor.cpp:795]
MeleePowerFantasy!FObjectReplicator::ReceivedRPC() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataReplication.cpp:1200]
MeleePowerFantasy!FObjectReplicator::ReceivedBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataReplication.cpp:1033]
MeleePowerFantasy!UActorChannel::ProcessBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:2665]
MeleePowerFantasy!UActorChannel::ReceivedBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:2517]
MeleePowerFantasy!UChannel::ReceivedSequencedBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:379]
MeleePowerFantasy!UChannel::ReceivedNextBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:793]
MeleePowerFantasy!UChannel::ReceivedRawBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:477]
MeleePowerFantasy!UNetConnection::ReceivedPacket() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\NetConnection.cpp:2426]
MeleePowerFantasy!UNetConnection::ReceivedRawPacket() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\NetConnection.cpp:1221]
MeleePowerFantasy!UIpNetDriver::TickDispatch() [C:\Tools\UnrealEngineSource\Engine\Plugins\Online\OnlineSubsystemUtils\Source\OnlineSubsystemUtils\Private\IpNetDriver.cpp:789]
MeleePowerFantasy!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float)>::ExecuteIfSafe() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:711]
MeleePowerFantasy!TBaseMulticastDelegate::Broadcast() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:1013]
MeleePowerFantasy!UWorld::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1421]
MeleePowerFantasy!UGameEngine::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1666]
MeleePowerFantasy!FEngineLoop::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4485]
MeleePowerFantasy!GuardedMain() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Launch.cpp:173]
MeleePowerFantasy!GuardedMainWrapper() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:134]
MeleePowerFantasy!WinMain() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:263]
MeleePowerFantasy!__scrt_common_main_seh() [d:\agent_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

This next one actually references line 604 of my own file, MeleePowerFantasyCharacter.cpp, on which a simple parameterless server RPC is called. This crash is more rare:

LoginId:cb7315ea465f4d48a6e2f5b4cdb74ce8
EpicAccountId:7f8b5118ebf549a6be00f95e4de9d185
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000260
MeleePowerFantasy!UObject::ProcessEvent() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1912]
MeleePowerFantasy!AActor::ProcessEvent() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\Actor.cpp:795]
MeleePowerFantasy!AMeleePowerFantasyCharacter::Tick() [C:\Seb_Games\MeleePowerFantasyV2\MeleePowerFantasy\Source\MeleePowerFantasy\MeleePowerFantasyCharacter.cpp:604]
MeleePowerFantasy!AActor::TickActor() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\Actor.cpp:996]
MeleePowerFantasy!FActorTickFunction::ExecuteTick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\Actor.cpp:169]
MeleePowerFantasy!FTickFunctionTask::DoTask() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:286]
MeleePowerFantasy!TGraphTask::ExecuteTask() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:850]
MeleePowerFantasy!FNamedTaskThread::ProcessTasksNamedThread() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:686]
MeleePowerFantasy!FNamedTaskThread::ProcessTasksUntilQuit() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:583]
MeleePowerFantasy!FTaskGraphImplementation::WaitUntilTasksComplete() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:1464]
MeleePowerFantasy!FTickTaskSequencer::ReleaseTickGroup() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:560]
MeleePowerFantasy!FTickTaskManager::RunTickGroup() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\TickTaskManager.cpp:1528]
MeleePowerFantasy!UWorld::RunTickGroup() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:782]
MeleePowerFantasy!UWorld::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1553]
MeleePowerFantasy!UGameEngine::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1666]
MeleePowerFantasy!FEngineLoop::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4485]
MeleePowerFantasy!GuardedMain() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Launch.cpp:173]
MeleePowerFantasy!GuardedMainWrapper() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:134]
MeleePowerFantasy!WinMain() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:263]
MeleePowerFantasy!__scrt_common_main_seh() [d:\agent_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Here is one crash that I have seen on clients:

LoginId:6167a21b4e9a790902a377bb78bc5ff7
EpicAccountId:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x00000238
MeleePowerFantasy!UFunction::Invoke() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\CoreUObject\Private\UObject\Class.cpp:4908]
MeleePowerFantasy!UObject::ProcessEvent() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\CoreUObject\Private\UObject\ScriptCore.cpp:1912]
MeleePowerFantasy!AActor::ProcessEvent() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\Actor.cpp:795]
MeleePowerFantasy!FRepLayout::CallRepNotifies() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\RepLayout.cpp:3787]
MeleePowerFantasy!FObjectReplicator::CallRepNotifies() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataReplication.cpp:1913]
MeleePowerFantasy!UActorChannel::ProcessBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:2697]
MeleePowerFantasy!UActorChannel::ReceivedBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:2517]
MeleePowerFantasy!UChannel::ReceivedSequencedBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:379]
MeleePowerFantasy!UChannel::ReceivedNextBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:793]
MeleePowerFantasy!UChannel::ReceivedRawBunch() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\DataChannel.cpp:477]
MeleePowerFantasy!UNetConnection::ReceivedPacket() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\NetConnection.cpp:2426]
MeleePowerFantasy!UNetConnection::ReceivedRawPacket() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\NetConnection.cpp:1221]
MeleePowerFantasy!UIpNetDriver::TickDispatch() [C:\Tools\UnrealEngineSource\Engine\Plugins\Online\OnlineSubsystemUtils\Source\OnlineSubsystemUtils\Private\IpNetDriver.cpp:789]
MeleePowerFantasy!TBaseUObjectMethodDelegateInstance<0,UNetDriver,void __cdecl(float)>::ExecuteIfSafe() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Public\Delegates\DelegateInstancesImpl.h:711]
MeleePowerFantasy!TBaseMulticastDelegate::Broadcast() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Core\Public\Delegates\DelegateSignatureImpl.inl:1013]
MeleePowerFantasy!UWorld::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\LevelTick.cpp:1421]
MeleePowerFantasy!UGameEngine::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Engine\Private\GameEngine.cpp:1666]
MeleePowerFantasy!FEngineLoop::Tick() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:4485]
MeleePowerFantasy!GuardedMain() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Launch.cpp:173]
MeleePowerFantasy!GuardedMainWrapper() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:134]
MeleePowerFantasy!WinMain() [C:\Tools\UnrealEngineSource\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:263]
MeleePowerFantasy!__scrt_common_main_seh() [d:\agent_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

This is the relevant part of MeleePowerFantasyCharacter.cpp:

		if (GetStamina() >= FireStaminaCost * GetMaxStamina())
		{
			HandleFire();   //THIS IS LINE 603.  The crash reporter reported line 604, but it seems to tend to add 1 to the actual line number.
			//Its header definition looks like:  	UFUNCTION(Server, Reliable) void HandleFire();
		}

I wanted to attach the *.h file in case it’s necessary to see what type of UFUNCTIONs and UPROPERTYs I’m using, but the upload seems to not be working on Chrome/Windows 10, so I’ll just host it here

Thanks for any help! Would love to know if there is a workaround. Without intimate knowledge of UE4’s net code, I’m probably going to have to redo the entirety of my game’s net code in Blueprints as a stab in the dark at fixing these crashes, but I figured I would post here first.

EDIT: I’ve confirmed this crash is present in both 4.24 and 4.25.