We are facing a crash that has the following callstack :
[ 00 ] RtlpWaitOnCriticalSection ( ntdll.dll )
[ 01 ] RtlpEnterCriticalSectionContended ( ntdll.dll )
[ 02 ] RtlEnterCriticalSection ( ntdll.dll )
[ 03 ] EnterCriticalSection(Windows::CRITICAL_SECTION *) ( MinimalWindowsApi.h:238 )
[ 04 ] FWindowsCriticalSection::Lock() ( WindowsCriticalSection.h:44 )
[ 05 ] FScopeLock::{ctor}(FWindowsCriticalSection *) ( ScopeLock.h:39 )
[ 06 ] FD3D12BaseShaderResource::RemoveRenameListener(FD3D12ShaderResourceRenameListener *) ( D3D12Resources.h:893 )
[ 07 ] FD3D12View::~FD3D12View() ( D3D12View.cpp:242 )
[ 08 ] FD3D12ShaderResourceView_RHI::`scalar deleting destructor’(unsigned int) ( LastFlagClient-Win64-Shipping.exe )
[ 09 ] FRHIResource::DeleteResources(TArray<FRHIResource *,TSizedDefaultAllocator<32> > const &) ( RHIResources.cpp:71 )
[ 10 ] FRHICommandListExecutor::FSubmitState::Submit(FRHICommandListExecutor::FSubmitState::FSubmitArgs const &) ( RHICommandList.cpp:1056 )
[ 11 ] UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<0>,void __cdecl(void)>::operator()() ( Function.h:470 )
[ 12 ] FRHICommandListExecutor::FTaskPipe::Execute(FRHICommandListExecutor::FTaskPipe::FTask *,TRefCountPtr<FBaseGraphTask> const &) ( RHICommandList.cpp:627 )
[…]
Reading about RtlEnterCriticalSection, I don’t see how it could crash unless it’s not properly initialized but FScopeLock will make sure it is initialized so that triggered my assumption that we do get memory stomping or a race condition.
I’ve tried to run with stompmalloc but it makes the game so slow that it’s unplayable. We only repro the crash rarely so that doesn’t become an option.
Is there a way to use stompmalloc only for certain allocators? How would I make that happen?
I am also planning to run with -enableasan.