JetBrains / UnrealLink

Apache License 2.0
130 stars 24 forks source link

Memory access crash from RiderLogging when using Visual Studio #276

Open michael-fps opened 8 months ago

michael-fps commented 8 months ago

Hi, we have UnrealLink/RiderLink integrated into our project under /Plugins/Developer/RiderLink with this version: "FileVersion": 3, "Version": 1, "VersionName": "2023.1.0.163"

We need to be flexible which IDE our team uses between VS and Rider. When a dev runs Unreal Editor from Visual Studio they get the crash below when they exit the editor in the normal manner. How do we correct this, please?

[Inline Frame] UnrealEditor-RiderLogging.dll!FMRSWRecursiveAccessDetector::AcquireWriteAccess::l5::::operator()() Line 568 C++ [Inline Frame] UnrealEditor-RiderLogging.dll!FMRSWRecursiveAccessDetector::AcquireWriteAccess() Line 568 C++ [Inline Frame] UnrealEditor-RiderLogging.dll!FMRSWRecursiveAccessDetector::AcquireWriteAccess(FMRSWRecursiveAccessDetector::FDestructionSentinel &) Line 612 C++ UnrealEditor-RiderLogging.dll!TDelegateAccessHandlerBase::FWriteAccessScope::FWriteAccessScope(FMRSWRecursiveAccessDetector & InAccessDetector) Line 139 C++ [Inline Frame] UnrealEditor-RiderLogging.dll!TDelegateAccessHandlerBase::GetWriteAccessScope() Line 158 C++ [Inline Frame] UnrealEditor-RiderLogging.dll!TDelegateBase::Unbind() Line 170 C++ UnrealEditor-RiderLogging.dll!FRiderLoggingModule::StartupModule::__l2::::operator()() Line 130 C++ [Inline Frame] UnrealEditor-RD.dll!std::_Func_class::operator()() Line 883 C++ UnrealEditor-RD.dll!rd::LifetimeImpl::terminate() Line 33 C++ UnrealEditor-RiderLogging.dll!FRiderLoggingModule::ShutdownModule() Line 140 C++ [Inline Frame] UnrealEditor-Core.dll!FModuleManager::UnloadModule(const FName) Line 723 C++ UnrealEditor-Core.dll!FModuleManager::UnloadModulesAtShutdown() Line 853 C++ UnrealEditor.exe!FEngineLoop::Exit() Line 5129 C++ [Inline Frame] UnrealEditor.exe!EngineExit() Line 72 C++ [Inline Frame] UnrealEditor.exe!GuardedMain::l2::EngineLoopCleanupGuard::{dtor}() Line 126 C++ UnrealEditor.exe!GuardedMain(const wchar_t CmdLine) Line 202 C++ UnrealEditor.exe!LaunchWindowsStartup(HINSTANCE__ hInInstance, HINSTANCE hPrevInstance, char formal, int nCmdShow, const wchar_t CmdLine) Line 247 C++ UnrealEditor.exe!WinMain(HINSTANCE__ hInInstance, HINSTANCE__ hPrevInstance, char pCmdLine, int nCmdShow) Line 298 C++ [External Code]

SleepyHippo commented 7 months ago

Meet the same problem. But it seems like an Ensure error:

LogOutputDevice: Error: Ensure condition failed: ReaderIndex != INDEX_NONE [File:\Engine\Source\Runtime\Core\Public\Misc\MTAccessDetector.h] [Line: 570] 
Either a race detected (1 reader(s) on another thread(s) while acquiring write access on the current thread) or the access detector was trivially relocated:
Current thread 76504 callstack:
0x000001d5cac399dd UnrealEditor-RiderLogging-Win64-DebugGame.dll!FMRSWRecursiveAccessDetector::GetCurrentThreadCallstack() [\Engine\Source\Runtime\Core\Public\Misc\MTAccessDetector.h:368]
0x000001d5cac439a7 UnrealEditor-RiderLogging-Win64-DebugGame.dll!`FMRSWRecursiveAccessDetector::AcquireWriteAccess'::`5'::<lambda_2>::operator()() [\Engine\Source\Runtime\Core\Public\Misc\MTAccessDetector.h:568]
0x000001d5cac420eb UnrealEditor-RiderLogging-Win64-DebugGame.dll!DispatchCheckVerify<bool,`FMRSWRecursiveAccessDetector::AcquireWriteAccess'::`5'::<lambda_2> >() [\Engine\Source\Runtime\Core\Public\Misc\AssertionMacros.h:195]
0x000001d5cac35c54 UnrealEditor-RiderLogging-Win64-DebugGame.dll!TDelegateAccessHandlerBase<FNotThreadSafeDelegateMode>::FWriteAccessScope::FWriteAccessScope() [\Engine\Source\Runtime\Core\Public\Delegates\DelegateAccessHandler.h:139]
0x000001d5cac381ed UnrealEditor-RiderLogging-Win64-DebugGame.dll!`FRiderLoggingModule::StartupModule'::`2'::<lambda_3>::operator()() [\Project\Plugins\Developer\RiderLink\Source\RiderLogging\Private\RiderLogging.cpp:130]
0x000001d5cac3c3d2 UnrealEditor-RiderLogging-Win64-DebugGame.dll!std::_Func_impl_no_alloc<`FRiderLoggingModule::StartupModule'::`2'::<lambda_3>,void>::_Do_call() [C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\INCLUDE\functional:812]
0x000001d5ca86d0b8 UnrealEditor-RD-Win64-DebugGame.dll!std::_Func_class<void>::operator()() [C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.38.33130\INCLUDE\functional:855]
0x000001d5ca870a20 UnrealEditor-RD-Win64-DebugGame.dll!rd::LifetimeImpl::terminate() [\Project\Plugins\Developer\RiderLink\Source\RD\src\rd_core_cpp\src\main\lifetime\LifetimeImpl.cpp:36]
0x000001d5ca86a832 UnrealEditor-RD-Win64-DebugGame.dll!rd::LifetimeDefinition::terminate() [\Project\Plugins\Developer\RiderLink\Source\RD\src\rd_core_cpp\src\main\lifetime\LifetimeDefinition.cpp:24]
0x000001d5cac3b550 UnrealEditor-RiderLogging-Win64-DebugGame.dll!FRiderLoggingModule::ShutdownModule() [\Project\Plugins\Developer\RiderLink\Source\RiderLogging\Private\RiderLogging.cpp:140]
0x00007ffdc7d0b4c4 UnrealEditor-Core.dll!UnknownFunction []
0x00007ff6a452b5dc UnrealEditor-Win64-DebugGame.exe!FEngineLoop::Exit() [\Engine\Source\Runtime\Launch\Private\LaunchEngineLoop.cpp:5140]
0x00007ff6a452cb1f UnrealEditor-Win64-DebugGame.exe!GuardedMain() [\Engine\Source\Runtime\Launch\Private\Launch.cpp:202]
0x00007ff6a4530099 UnrealEditor-Win64-DebugGame.exe!LaunchWindowsStartup() [\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:248]
0x00007ff6a4546044 UnrealEditor-Win64-DebugGame.exe!WinMain() [\Engine\Source\Runtime\Launch\Private\Windows\LaunchWindows.cpp:299]
0x00007ff6a454922a UnrealEditor-Win64-DebugGame.exe!__scrt_common_main_seh() [D:\a\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
0x00007ffe4baa257d KERNEL32.DLL!UnknownFunction []
0x00007ffe4c34aa58 ntdll.dll!UnknownFunction []
DecoyRS commented 7 months ago

There were few fixes regarding the threading, logging and delegate crashes in RiderLink through the last month. Would you be so kind to take changes from https://github.com/JetBrains/UnrealLink/tree/main/src/cpp/RiderLink/Source/RiderLogging and swap with the local version and check if the issue persists?