ultraleap / UnrealPlugin

Ultraleap SDK for the Unreal Engine.
264 stars 68 forks source link

Fatal error on Ue4 project shutdown #113

Closed danrol closed 2 years ago

danrol commented 2 years ago

Hello. I'm using Ultraleap in C++. Sometimes when I close packaged project, I receive shutdown error. It happened to me in 4.3.0.0 and 3.7.0.0 version. It is more common if packaged project is small. So maybe it is related to shutdown order. UE 4.27 (latest)

Error message:

[2022.05.18-12.05.35:102][847]LogWindows: Error: === Critical error: === [2022.05.18-12.05.35:102][847]LogWindows: Error: [2022.05.18-12.05.35:102][847]LogWindows: Error: Fatal error! [2022.05.18-12.05.35:102][847]LogWindows: Error: [2022.05.18-12.05.35:102][847]LogWindows: Error: Unhandled Exception: EXCEPTION_ACCESS_VIOLATION reading address 0x000002231c982390 [2022.05.18-12.05.35:102][847]LogWindows: Error: [2022.05.18-12.05.35:102][847]LogWindows: Error: [Callstack] 0x00007ff768ade5d1 ShootHouse_423.exe!UObjectBase::IsValidLowLevel() [] [2022.05.18-12.05.35:102][847]LogWindows: Error: [Callstack] 0x00007ff76707ee3d ShootHouse_423.exe!FBodyStateSkeletonStorage::RemoveDevice() [C:\gitlab\builds\u6JRnJXD\0\xr\integrations\unreal\uhi-unreal-tracking\UltraleapTracking\HostProject\Plugins\UltraleapTracking\Source\ThirdParty\BodyState\Private\BodyStateSkeletonStorage.cpp:88] [2022.05.18-12.05.35:102][847]LogWindows: Error: [Callstack] 0x00007ff767076c70 ShootHouse_423.exe!UBodyStateBPLibrary::DetachDevice() [C:\gitlab\builds\u6JRnJXD\0\xr\integrations\unreal\uhi-unreal-tracking\UltraleapTracking\HostProject\Plugins\UltraleapTracking\Source\ThirdParty\BodyState\Private\BodyStateBPLibrary.cpp:58] [2022.05.18-12.05.35:102][847]LogWindows: Error: [Callstack] 0x00007ff767044c3d ShootHouse_423.exe!FUltraleapTrackingInputDevice::~FUltraleapTrackingInputDevice() [C:\gitlab\builds\u6JRnJXD\0\xr\integrations\unreal\uhi-unreal-tracking\UltraleapTracking\HostProject\Plugins\UltraleapTracking\Source\UltraleapTrackingCore\Private\FUltraleapTrackingInputDevice.cpp:366] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff767049bb4 ShootHouse_423.exe!FUltraleapTrackingInputDevice::scalar deleting destructor'() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff7670407b9 ShootHouse_423.exe!FUltraleapTrackingPlugin::scalar deleting destructor'() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff7684a6b26 ShootHouse_423.exe!FModuleManager::UnloadModule() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff7684a7280 ShootHouse_423.exe!FModuleManager::UnloadModulesAtShutdown() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff766b18e8c ShootHouse_423.exe!FEngineLoop::Exit() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff766b19c22 ShootHouse_423.exe!GuardedMain() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff766b19c6a ShootHouse_423.exe!GuardedMainWrapper() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff766b1c06c ShootHouse_423.exe!LaunchWindowsStartup() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff766b2d8b4 ShootHouse_423.exe!WinMain() [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ff76dba696e ShootHouse_423.exe!__scrt_common_main_seh() [d:\a01_work\12\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ffe98d57034 KERNEL32.DLL!UnknownFunction [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [Callstack] 0x00007ffe9a642651 ntdll.dll!UnknownFunction [] [2022.05.18-12.05.35:103][847]LogWindows: Error: [2022.05.18-12.05.35:123][847]LogWindows: FPlatformMisc::RequestExit(1) [2022.05.18-12.05.35:123][847]LogWindows: FPlatformMisc::RequestExitWithStatus(1, 3) [2022.05.18-12.05.35:123][847]LogCore: Engine exit requested (reason: Win RequestExit; note: exit was already requested) [2022.05.18-12.05.35:136][847]Log file closed, 05/18/22 08:05:35

JimSimons-UH commented 2 years ago

Hi, thanks for reporting this, are you happy to share your project so we can reproduce the issue? Alternatively, can you provide more details of how you are using the plugin from C++?

danrol commented 2 years ago

LeapMotionCode.zip

The problem is that sometimes crash is happening even if leap motion device is not connected. We are not using leap motion on every pc right now. Simulations are multiplayer.

I use leap motion next way: Get data from the plugin->replicate to other pcs->Update skeleton animations in FAnimNode_Base custom subclass child. We use full body in VR. I only take hand's data from leap motion

danrol commented 2 years ago

Hi. Do you know what may be causing the problem?

JimSimons-UH commented 2 years ago

I can't reproduce it at the moment, tested with a simple C++ only project and packaged, as an experiment, can you try commenting out the detach device call?:

`void FUltraleapTrackingInputDevice::ShutdownLeap() { // Detach from body state

// UBodyStateBPLibrary::DetachDevice(BodyStateDeviceId);

`

danrol commented 2 years ago

We are testing it. I'll let you know. It doesn't happen after every game shutdown. So, it will take time to verify

danrol commented 2 years ago

// UBodyStateBPLibrary::DetachDevice(BodyStateDeviceId); caused even more crashes. In the end I just removed plugin shutdown from leap motion plugin shutdown process (destructor, ShutdownLeap etc.) in the source code. No problems for last few days. Feels pretty safe to say that it solved my issue. Thanks for your great product :)