HybridV2RenderSystem issues with VR SIGSEGV errors

Hi!

Ive been having some seemingly random crashes when testing out builds of my VR game which uses DOTS 0.51 and of course Hybrid Renderer 0.51. Annoyingly these result in SIGSEGV errors in player, or in editor a crash, enabling stack traces and leak detection i think i've found that its something to do with using VR and the Hybrid Renderer V2 (potentially specific to my Oculus Quest via Airlink setup which has a additional streaming process outside of unity, and fact im taking headset on/off which resets OpenXR).

The error messages are below but all seem to relate to HybridV2RenderSystem. Im not sure if its anything i can sort out on my side but would be good to know if a) its a common issue in particular with VR (since i havnt replicated this error with headset off) b) if theres a solution.

Thanks for any help!
Mark.

Invalid memory pointer was detected in ThreadsafeLinearAllocator::smile:eallocate!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArrayDispose:smile:ispose ()
Unity.Collections.NativeArrayDisposeJob:Execute ()
Unity.Jobs.IJobExtensions/JobStruct`1<Unity.Collections.NativeArrayDisposeJob>:Execute (Unity.Collections.NativeArrayDisposeJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)

[C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp line 331]

Time: 15:10:17
Assertion failed on expression: 'p >= m_Blocks[blockIndex].ptr && p < m_Blocks[blockIndex].ptr + atomic_load(&m_Blocks[blockIndex].blockSize)'
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArray`1<long>:smile:ispose ()
Unity.Rendering.HybridRendererSystem:UpdateAllBatches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2710)
Unity.Rendering.HybridRendererSystem:UpdateHybridV2Batches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2120)
Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)

[Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]

Time: 15:10:17
Assertion failed on expression: 'allocCount >= 0'
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArray`1<long>:smile:ispose ()
Unity.Rendering.HybridRendererSystem:UpdateAllBatches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2710)
Unity.Rendering.HybridRendererSystem:UpdateHybridV2Batches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2120)
Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)

[Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]

Time: 15:11:49
Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
Invalid memory pointer was detected in ThreadsafeLinearAllocator::smile:eallocate!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArrayDispose:smile:ispose ()
Unity.Collections.NativeArrayDisposeJob:Execute ()
Unity.Jobs.IJobExtensions/JobStruct`1<Unity.Collections.NativeArrayDisposeJob>:Execute (Unity.Collections.NativeArrayDisposeJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)

[C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp line 331]

Time: 15:11:49
Invalid memory pointer was detected in ThreadsafeLinearAllocator::smile:eallocate!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArray`1<long>:smile:ispose ()
Unity.Rendering.HybridRendererSystem:UpdateAllBatches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2710)
Unity.Rendering.HybridRendererSystem:UpdateHybridV2Batches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2120)
Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)

[Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]

Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
[XR] [21528] [15:15:14.068][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_FOCUSED->XR_SESSION_STATE_VISIBLE session=72194947092054017 time=156097959275400
[XR] [21528] [15:15:14.069][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_VISIBLE->XR_SESSION_STATE_SYNCHRONIZED session=72194947092054017 time=156097959278800
[XR] [21528] [15:15:14.069][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_SYNCHRONIZED->XR_SESSION_STATE_STOPPING session=72194947092054017 time=156097959374600
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
XRTextureManager::RequestDestroyTexture
[XR] [21528] [15:15:14.074][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_STOPPING->XR_SESSION_STATE_IDLE session=72194947092054017 time=156097964558000
[XR] [21528] [15:15:36.363][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_IDLE->XR_SESSION_STATE_READY session=72194947092054017 time=156120253913000
[XR] [30780] [15:15:36.392][Error  ] xrBeginFrame: XR_FRAME_DISCARDED
[XR] [21528] [15:15:36.392][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_READY->XR_SESSION_STATE_SYNCHRONIZED session=72194947092054017 time=156120283058600
[XR] [21528] [15:15:36.503][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_SYNCHRONIZED->XR_SESSION_STATE_STOPPING session=72194947092054017 time=156120393817999
[XR] [21528] [15:15:36.504][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_STOPPING->XR_SESSION_STATE_IDLE session=72194947092054017 time=156120394697400

Time: 15:15:36
Invalid memory pointer was detected in ThreadsafeLinearAllocator::smile:eallocate!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArrayDispose:smile:ispose ()
Unity.Collections.NativeArrayDisposeJob:Execute ()
Unity.Jobs.IJobExtensions/JobStruct`1<Unity.Collections.NativeArrayDisposeJob>:Execute (Unity.Collections.NativeArrayDisposeJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)

[C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp line 331]

Time: 15:15:36
Invalid memory pointer was detected in ThreadsafeLinearAllocator::smile:eallocate!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.NativeArray`1<long>:smile:ispose ()
Unity.Rendering.HybridRendererSystem:UpdateAllBatches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2710)
Unity.Rendering.HybridRendererSystem:UpdateHybridV2Batches (Unity.Jobs.JobHandle) (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2120)
Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)

[Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]

Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
[XR] [21528] [15:15:37.641][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_IDLE->XR_SESSION_STATE_READY session=72194947092054017 time=156121531788300
[XR] [30780] [15:15:37.668][Error  ] xrBeginFrame: XR_FRAME_DISCARDED
[XR] [21528] [15:15:37.668][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_READY->XR_SESSION_STATE_SYNCHRONIZED session=72194947092054017 time=156121559104100
[XR] [21528] [15:15:37.807][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_SYNCHRONIZED->XR_SESSION_STATE_VISIBLE session=72194947092054017 time=156121698027899
[XR] [21528] [15:15:37.807][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_VISIBLE->XR_SESSION_STATE_FOCUSED session=72194947092054017 time=156121698034600
[XR] [21528] [15:15:37.807][Info   ]
1 Like

Just came here to post this exact same bug :smile:... and the first thread in the forum I see is yours.

You beat me to it:

[Error] Invalid memory pointer was detected in ThreadsafeLinearAllocator::smile:eallocate!
Unity.Collections.NativeArray`1<long>.Dispose()

HybridRendererSystem.UpdateAllBatches() at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2710
2708:   unreferencedInternalIndices.Dispose();
2709:   batchRequiresUpdates.Dispose();
-->2710:   batchHadMovingEntities.Dispose();
2712:   uploadsExecuted.Complete();

HybridRendererSystem.UpdateHybridV2Batches() at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2120
2118:              m_HybridRenderedQuery.CreateArchetypeChunkArray(Allocator.TempJob))
2119:   {
-->2120:       done = UpdateAllBatches(inputDependencies);
2121:   }

HybridRendererSystem.OnUpdate() at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157
2156:   Profiler.BeginSample("UpdateHybridV2Batches");
-->2157:   done = UpdateHybridV2Batches(Dependency);
2158:   Profiler.EndSample();

SystemBase.Update() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400
398:   try
399:   {
-->400:       OnUpdate();
401:   }
402:   catch

ComponentSystemGroup.UpdateAllSystems() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583
581:           // Update managed code.
582:           var sys = m_systemsToUpdate[index.Index];
-->583:           sys.Update();
584:       }
585:   }

ComponentSystemGroup.OnUpdate() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523
521:   if (RateManager == null)
522:   {
-->523:       UpdateAllSystems();
524:   }
525:   else

ComponentSystem.Update() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114
112:   try
113:   {
-->114:       OnUpdate();
115:   }
116:   finally

ScriptBehaviourUpdateOrder/DummyDelegateWrapper.TriggerUpdate() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426
424:       if (m_System.m_StatePtr != null)
425:       {
-->426:           m_System.Update();
427:       }
428:   }

Bug Report: IN-10395

I am not using any VR but simple textured meshes with HybridRenderer v2*.*

Good to see im not the only one!

I am still getting this error but i think the actual crashes were caused by a different issue for me in regards to a seperate system referencing LocalToWorld for a entity that had just been deleted. Sorted that and removed a load of memory leaks and it seems to be not crashing. May be proven wrong about that since the issue happened pretty rarely in the first place. Just released a demo on steam so if it isnt sorted im sure i'll hear about it shortly!

1 Like

See this thread to fix:
https://discussions.unity.com/t/882702

1 Like