ayumax / ObjectDeliverer

ObjectDeliverer is a data transmission / reception library for Unreal Engine (C ++, Blueprint).
https://www.unrealengine.com/marketplace/ja/slug/objectdeliverer
MIT License
163 stars 37 forks source link

Creating UObjects while Collecting Garbage is not allowed #54

Open Gisleburt opened 2 years ago

Gisleburt commented 2 years ago

Writing this up now just in case anyone has a quick answer, but I'm getting this error while trying to receive JSON objects via UDP.

We are sending around a dozen requests per second. Not sure if that would have an impact.

I'll have a little investigate anyway

[2022.05.17-15.06.29:226][920]LogThreadingWindows: Error: Runnable thread ObjectDeliverer UDPSocket PollingThread crashed.
[2022.05.17-15.06.29:226][920]LogWindows: Error: === Critical error: ===
[2022.05.17-15.06.29:226][920]LogWindows: Error: 
[2022.05.17-15.06.29:226][920]LogWindows: Error: Assertion failed: !IsGarbageCollecting() [File:D:\build\++UE5\Sync\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2441] 
[2022.05.17-15.06.29:226][920]LogWindows: Error: Unable to create new object: ProtocolUdpSocket /Engine/Transient.ProtocolUdpSocketReceiver_0.None. Creating UObjects while Collecting Garbage is not allowed!
[2022.05.17-15.06.29:226][920]LogWindows: Error: 
[2022.05.17-15.06.29:226][920]LogWindows: Error: 
[2022.05.17-15.06.29:226][920]LogWindows: Error: [Callstack] 0x00007ff94fd83fe4 UnrealEditor-CoreUObject.dll!UnknownFunction []
[2022.05.17-15.06.29:226][920]LogWindows: Error: [Callstack] 0x00007ff94fd85eee UnrealEditor-CoreUObject.dll!UnknownFunction []
[2022.05.17-15.06.29:226][920]LogWindows: Error: [Callstack] 0x00007ff8e0c194db UnrealEditor-ObjectDeliverer.dll!UProtocolUdpSocketReceiver::ReceivedData() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ObjectDeliverer\Source\ObjectDeliverer\Private\Protocol\ProtocolUdpSocketReceiver.cpp:115]
[2022.05.17-15.06.29:227][920]LogWindows: Error: [Callstack] 0x00007ff8e0c0be69 UnrealEditor-ObjectDeliverer.dll!UE::Core::Private::Function::TFunctionRefCaller<<lambda_8993b94d5aa4af31062aea6c2169b2be>,bool __cdecl(void)>::Call() [D:\RocketSync\5.0.0-19505902+++UE5+Release-5.0\Working\Engine\Source\Runtime\Core\Public\Templates\Function.h:539]
[2022.05.17-15.06.29:227][920]LogWindows: Error: [Callstack] 0x00007ff8e0c1bf28 UnrealEditor-ObjectDeliverer.dll!FODWorkerThread::Run() [D:\build\U5M-Marketplace\Sync\LocalBuilds\PluginTemp\HostProject\Plugins\ObjectDeliverer\Source\ObjectDeliverer\Private\Utils\ODWorkerThread.cpp:32]
[2022.05.17-15.06.29:227][920]LogWindows: Error: [Callstack] 0x00007ff942ba83ab UnrealEditor-Core.dll!UnknownFunction []
[2022.05.17-15.06.29:227][920]LogWindows: Error: [Callstack] 0x00007ff942ba13b0 UnrealEditor-Core.dll!UnknownFunction []
[2022.05.17-15.06.29:227][920]LogWindows: Error: [Callstack] 0x00007ff99c777034 KERNEL32.DLL!UnknownFunction []
[2022.05.17-15.06.29:227][920]LogWindows: Error: [Callstack] 0x00007ff99e742651 ntdll.dll!UnknownFunction []
[2022.05.17-15.06.29:227][920]LogWindows: Error: 
[2022.05.17-15.06.29:227][920]LogWindows: Error: Crash in runnable thread ObjectDeliverer UDPSocket PollingThread
Gisleburt commented 2 years ago

Rate limiting to 5/s didn't help 🤔

Gisleburt commented 2 years ago

So we think this was caused by objects that didn't specify every property on the class we were using in Create Object Delivery Box Using Json

Removing these objects from the stream seems to have fixed the more frequent crashes. We still had some crashes though and we never worked out what they were.

We were using the package in a hackathon (it worked brilliantly during the demo, and saved us a ton of time, so thank you for making it) which has now ended so I'm in no rush for a resolution but would be happy to help if I can.

Gisleburt commented 2 years ago

Oh, I did check and I was able to send nearly 2000 objects per second to the plugin and it was fine with it, so rate limiting had nothing to do with it.

Once we resolved the object shape issue it only seemed to crash when closing the application or if there were problems connecting to the VR headset (which was streaming over Wifi... but over TCP while we were using UDP for these packets so 🤷🏻‍♂️ )