mordentral / VRExpansionPlugin

A UE4-5 VR framework
https://www.vreue4.com
MIT License
542 stars 113 forks source link

Editor crashes if component variables are edited #53

Open Meow opened 3 months ago

Meow commented 3 months ago

The editor crashes with this plugin installed in Unreal Engine 5.4.3. Steps to reproduce:

  1. Create blank C++ project
  2. Create a class derived from VRCharacter
  3. Create a blueprint derived from our newly created class
  4. Open the blueprint of the character class
  5. Search for "collision" in the variables
  6. Flick "Allow Simulating Collision" variable on and off repeatedly
  7. Observe the editor crash

Unsure if that's an Unreal Engine problem, or the plugin problem. Would appreciate any help regardless.

mordentral commented 3 months ago

It doesn't crash for me doing that, you'll have to provide some sort of crash report. Also though if spamming editing that particular variable is the only cause it wouldn't be in the plugin regardless.

Meow commented 3 months ago

This is strange. I tried to replicate it again and it threw a different error than it did yesterday (yesterday it was something related to reading null pointer in primitives code, now it's this). Appears to be an Unreal Editor bug of some kind, sigh, this silly engine never seems to just want to work without issues. It just bothers me a bit that it started occurring after I installed the VR expansion plugin, and might sometimes occur on first attempt to edit the variable (and thus crash the editor and nuke all of my progress). It usually occurs after hitting "play" and stopping the game at least once.

Exception thrown at 0x00007FFFDDDA36EC (UnrealEditor-Core.dll) in UnrealEditor.exe: 0xC0000005: Access violation reading location 0xFFFFFFFFFFFFFFFF.
    [Inline Frame] UnrealEditor-Core.dll!_mi_page_malloc(mi_heap_s *) Line 33   C
    [Inline Frame] UnrealEditor-Core.dll!mi_heap_malloc_small(mi_heap_s *) Line 79  C
    [Inline Frame] UnrealEditor-Core.dll!mi_heap_malloc(mi_heap_s *) Line 97    C
    UnrealEditor-Core.dll!_mi_heap_malloc_zero(mi_heap_s * heap, unsigned __int64 size, bool zero) Line 147 C
>   [Inline Frame] UnrealEditor-Core.dll!FMallocMimalloc::TryRealloc(void * Alignment, unsigned __int64) Line 140   C++
    UnrealEditor-Core.dll!FMallocMimalloc::Realloc(void * Ptr, unsigned __int64 NewSize, unsigned int Alignment) Line 157   C++
    [Inline Frame] UnrealEditor-Core.dll!FLowLevelMemTracker::IsEnabled() Line 1086 C++
    UnrealEditor-Core.dll!FMemory::Realloc(void * Original, unsigned __int64 Count, unsigned int Alignment) Line 118    C++
    UnrealEditor-Core.dll!TSizedHeapAllocator<32,FMemory>::ForAnyElementType::ResizeAllocation(int PreviousNumElements, int NumElements, unsigned __int64 NumBytesPerElement) Line 700  C++
    [Inline Frame] UnrealEditor-Renderer.dll!TSizedInlineAllocator<1,32,TSizedDefaultAllocator<32>>::ForElementType<UE::Tasks::Private::FTaskBase *>::ResizeAllocation(int) Line 905    C++
    [Inline Frame] UnrealEditor-Renderer.dll!TArray<UE::Tasks::Private::FTaskBase *,TSizedInlineAllocator<1,32,TSizedDefaultAllocator<32>>>::AllocatorResizeAllocation(int) Line 3068   C++
    UnrealEditor-Renderer.dll!TArray<UE::Tasks::Private::FTaskBase * __ptr64,TSizedInlineAllocator<1,32,TSizedDefaultAllocator<32>>>::ResizeGrow(int OldNum) Line 3120  C++
    [Inline Frame] UnrealEditor-Renderer.dll!TArray<UE::Tasks::Private::FTaskBase *,TSizedInlineAllocator<1,32,TSizedDefaultAllocator<32>>>::AddUninitialized() Line 1354   C++
    [Inline Frame] UnrealEditor-Renderer.dll!TArray<UE::Tasks::Private::FTaskBase *,TSizedInlineAllocator<1,32,TSizedDefaultAllocator<32>>>::Emplace(UE::Tasks::Private::FTaskBase * &) Line 2208   C++
    UnrealEditor-Renderer.dll!UE::Tasks::Private::FTaskBase::FPrerequisites<TSizedInlineAllocator<1,32,TSizedDefaultAllocator<32>>>::Push(UE::Tasks::Private::FTaskBase * Prerequisite) Line 738    C++
    UnrealEditor-Renderer.dll!UE::Tasks::Private::FTaskBase::AddPrerequisites(UE::Tasks::Private::FTaskBase & Prerequisite) Line 251    C++
    [Inline Frame] UnrealEditor-Renderer.dll!UE::Tasks::Private::FTaskBase::AddPrerequisites(const UE::Tasks::TTask<void> &) Line 260   C++
    [Inline Frame] UnrealEditor-Renderer.dll!UE::Tasks::FTaskEvent::AddPrerequisites(const UE::Tasks::TTask<void> &) Line 236   C++
    UnrealEditor-Renderer.dll!FVisibilityTaskData::LaunchVisibilityTasks(const UE::Tasks::Private::FTaskHandle & BeginInitVisibilityPrerequisites) Line 4198    C++
    UnrealEditor-Renderer.dll!LaunchVisibilityTasks(FRHICommandListImmediate & RHICmdList, FSceneRenderer & SceneRenderer, const UE::Tasks::Private::FTaskHandle & BeginInitVisibilityPrerequisites) Line 388   C++
    UnrealEditor-Renderer.dll!??R<lambda_1>@?1??OnRenderBegin@FSceneRenderer@@IEAAPEAVIVisibilityTaskData@@AEAVFRDGBuilder@@@Z@QEBA@AEBVFTaskHandle@Private@Tasks@UE@@@Z(const UE::Tasks::Private::FTaskHandle & StaticMeshUpdateTask) Line 3649    C++
    UnrealEditor-Renderer.dll!FScene::Update(FRDGBuilder & GraphBuilder, const FScene::FUpdateParameters & Parameters) Line 6714    C++
    UnrealEditor-Renderer.dll!FSceneRenderer::OnRenderBegin(FRDGBuilder & GraphBuilder) Line 3660   C++
    UnrealEditor-Renderer.dll!FDeferredShadingSceneRenderer::Render(FRDGBuilder & GraphBuilder) Line 1474   C++
    UnrealEditor-Renderer.dll!RenderViewFamilies_RenderThread(FRHICommandListImmediate & RHICmdList, const TArray<FSceneRenderer *,TSizedDefaultAllocator<32>> & SceneRenderers) Line 4832  C++
    UnrealEditor-Renderer.dll!??R<lambda_3>@?FJ@??BeginRenderingViewFamilies@FRendererModule@@UEAAXPEAVFCanvas@@V?$TArrayView@PEAVFSceneViewFamily@@H@@@Z@QEBA@AEAVFRHICommandListImmediate@@@Z(FRHICommandListImmediate & RHICmdList) Line 5121    C++
    [Inline Frame] UnrealEditor-RenderCore.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(FRHICommandListImmediate &)>::operator()(FRHICommandListImmediate &) Line 555    C++
    UnrealEditor-RenderCore.dll!??R<lambda_1>@?4??EnqueueAndLaunch@FRenderThreadCommandPipe@@AEAAXPEB_WAEAIUTStatId@@$$QEAV?$TUniqueFunction@$$A6AXAEAVFRHICommandListImmediate@@@Z@@@Z@QEBA@XZ() Line 1751 C++
    [Inline Frame] UnrealEditor-RenderCore.dll!UE::Core::Private::Function::TFunctionRefBase<UE::Core::Private::Function::TFunctionStorage<1>,void __cdecl(void)>::operator()() Line 555    C++
    [Inline Frame] UnrealEditor-RenderCore.dll!TFunctionGraphTaskImpl<void __cdecl(void),1>::DoTaskImpl(TUniqueFunction<void __cdecl(void)> & Function, ENamedThreads::Type) Line 1733  C++
    [Inline Frame] UnrealEditor-RenderCore.dll!TFunctionGraphTaskImpl<void __cdecl(void),1>::DoTask(ENamedThreads::Type) Line 1726  C++
    UnrealEditor-RenderCore.dll!TGraphTask<TFunctionGraphTaskImpl<void __cdecl(void),1>>::ExecuteTask(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & NewTasks, ENamedThreads::Type CurrentThread, bool bDeleteOnCompletion) Line 1235    C++
    [Inline Frame] UnrealEditor-Core.dll!FBaseGraphTask::Execute(TArray<FBaseGraphTask *,TSizedDefaultAllocator<32>> & CurrentThread, ENamedThreads::Type) Line 840 C++
    UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksNamedThread(int QueueIndex, bool bAllowStall) Line 760  C++
    UnrealEditor-Core.dll!FNamedTaskThread::ProcessTasksUntilQuit(int QueueIndex) Line 651  C++
    UnrealEditor-RenderCore.dll!RenderingThreadMain(FEvent * TaskGraphBoundSyncEvent) Line 413  C++
    UnrealEditor-RenderCore.dll!FRenderingThread::Run() Line 566    C++
    UnrealEditor-Core.dll!FRunnableThreadWin::Run() Line 149    C++
    UnrealEditor-Core.dll!FRunnableThreadWin::GuardedRun() Line 71  C++
    [External Code] 

EDIT

if you'd like to check out the exact project where the issue occurs, it's live in this open source repository: https://github.com/Meow/AsymmetricVR

mordentral commented 3 months ago

Are you sure you aren't running out of memory?

Meow commented 3 months ago

Yes. It barely uses 2-2.5GB of RAM at the time of the crash (and total system memory usage is less than 25%). VRAM usage also sits under 25% utilization.

mordentral commented 3 months ago

Talking about disk memory, but dunno, I don't know anyone else with this issue and its not plugin related.

Meow commented 3 months ago

I have 350GB free SSD space and only 1 partition.

MrGabr commented 2 months ago

I've been getting this specifically when a GrippableSphere is the root node of a Blueprint Actor, I have an attached Niagara component, and I connect "On System Finished (Niagara)" event to "Destroy Actor" targeting self. With that event in the graph connected to Destroy Actor, I can't change any dropdown variables on the GrippableSphere without crashing.

mordentral commented 2 months ago

I've been getting this specifically when a GrippableSphere is the root node of a Blueprint Actor, I have an attached Niagara component, and I connect "On System Finished (Niagara)" event to "Destroy Actor" targeting self. With that event in the graph connected to Destroy Actor, I can't change any dropdown variables on the GrippableSphere without crashing.

That is for sure entirely not plugin related, when the properties in editor are modified the way the engine works is that it reconstructs ALL of the components of an actor so that the preview shows it fresh (very expensive and weird but it does ensure that everything is correct). Its likely causing your particle effects to die trying to kill the temp actor the editor displays.

MrGabr commented 2 months ago

That is for sure entirely not plugin related

That was what I thought as well, but when I recreated the exact same setup on a normal SphereCollision, everything worked as normal. It was only on GrippableSphere that it crashed.

It's not a horribly work-stopping bug, though (at least for me) because I can just disconnect the nodes if I want to change anything, and reconnect them after.

mordentral commented 2 months ago

That is for sure entirely not plugin related

That was what I thought as well, but when I recreated the exact same setup on a normal SphereCollision, everything worked as normal. It was only on GrippableSphere that it crashed.

It's not a horribly work-stopping bug, though (at least for me) because I can just disconnect the nodes if I want to change anything, and reconnect them after.

The exact same log / crash message? Because I doubt that, the one there is regarding page file allocation and there isn't a single custom thing in the grippable sphere that would interact with that.

MrGabr commented 2 months ago

You're right, they are different. I've been getting that same access violation error at random times the time across the last 3 Unreal projects I've worked on and assumed when I shouldn't have. That one's probably an editor bug.

My GrippableSphere-specific crash code is an assertion error:

Error: appError called: Assertion failed: IsValid(this) [File:D:\build\++UE5\Sync\Engine\Source\Runtime\Engine\Private\ActorConstruction.cpp] [Line: 787]