UDP-Unreal
UDP-Unreal copied to clipboard
UE5.1 Editor crashes when stopping PIE while data is being received
Whenever PIE is stopped while a datastream is still sending UDP packets on a socket handled by UDPWrapper, the editor crashes with with the following trace:
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x0000000000000008
UnrealEditor_UDPWrapper!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<0>,void __cdecl(TArray<unsigned char,TSizedDefaultAllocator<32> > const &,FString const &,int const &)>::operator()() [C:\Unreal Engine\UE_5.1\Engine\Source\Runtime\Core\Public\Templates\Function.h:602] UnrealEditor_Core!TGraphTask<FAsyncGraphTask>::ExecuteTask() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Public\Async\TaskGraphInterfaces.h:1348] UnrealEditor_Core!FNamedTaskThread::ProcessTasksNamedThread() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:760] UnrealEditor_Core!FNamedTaskThread::ProcessTasksUntilIdle() [D:\build++UE5\Sync\Engine\Source\Runtime\Core\Private\Async\TaskGraph.cpp:660] UnrealEditor_Engine!FFrameEndSync::Sync() [D:\build++UE5\Sync\Engine\Source\Runtime\Engine\Private\UnrealEngine.cpp:12391] UnrealEditor!FEngineLoop::Tick() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5592] UnrealEditor!GuardedMain() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Launch.cpp:202] UnrealEditor!GuardedMainWrapper() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:107] UnrealEditor!LaunchWindowsStartup() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:244] UnrealEditor!WinMain() [D:\build++UE5\Sync\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:282] UnrealEditor!__scrt_common_main_seh() [D:\a_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288] kernel32 ntdll
Which callback type are you using? Got some examples?
I add a dynamic delegate in the constructor of an UCLASS of mine:
socket->OnReceivedBytes.AddDynamic(this, &AMyClass::OnReceive);
The function is declared as:
UFUNCTION()
virtual void OnReceive(const TArray<uint8>& Data, const FString& SourceIp, const int& SourcePort);
That function is defined in AMyClass
and then overridden by child classes.
I tried commenting my AddDynamic()
call and I still get a crash. I have no other AddDynamic()
calls related to UDPWrapper anywhere else in the project.
Does port 55971
ring a bell?
After some more testing it seems like the culprit is something within the code that opens the receive socket.
Looking at https://github.com/getnamo/UDP-Unreal/blob/master/Source/UDPWrapper/Private/UDPComponent.cpp#L270, just checking do you have 'receive data on game thread' enabled? If not it's possible you're getting a callback when the game is being unwound on a separate thread. Test with receive on gamethread enabled and see if that changes anything.
Hi.So it will work properly on ue5?
I closed this issue since I haven't seen this error in more than a year.