Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Bug HybridV2RenderSystem issues with VR SIGSEGV errors

Discussion in 'Graphics for ECS' started by mk1987, Jul 15, 2022.

  1. mk1987

    mk1987

    Joined:
    Mar 18, 2019
    Posts:
    53
    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.

    Code (CSharp Time: 15:10:17):
    1. Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
    2. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    3. Unity.Collections.NativeArrayDispose:Dispose ()
    4. Unity.Collections.NativeArrayDisposeJob:Execute ()
    5. Unity.Jobs.IJobExtensions/JobStruct`1<Unity.Collections.NativeArrayDisposeJob>:Execute (Unity.Collections.NativeArrayDisposeJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
    6.  
    7. [C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp line 331]
    8.  
    9. Time: 15:10:17
    10. Assertion failed on expression: 'p >= m_Blocks[blockIndex].ptr && p < m_Blocks[blockIndex].ptr + atomic_load(&m_Blocks[blockIndex].blockSize)'
    11. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    12. Unity.Collections.NativeArray`1<long>:Dispose ()
    13. 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)
    14. 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)
    15. Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
    16. Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
    17. Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
    18. Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
    19. Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
    20. Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)
    21.  
    22. [Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]
    23.  
    24. Time: 15:10:17
    25. Assertion failed on expression: 'allocCount >= 0'
    26. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    27. Unity.Collections.NativeArray`1<long>:Dispose ()
    28. 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)
    29. 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)
    30. Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
    31. Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
    32. Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
    33. Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
    34. Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
    35. Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)
    36.  
    37. [Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]
    38.  
    39. Time: 15:11:49
    40. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    41. Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
    42. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    43. Unity.Collections.NativeArrayDispose:Dispose ()
    44. Unity.Collections.NativeArrayDisposeJob:Execute ()
    45. Unity.Jobs.IJobExtensions/JobStruct`1<Unity.Collections.NativeArrayDisposeJob>:Execute (Unity.Collections.NativeArrayDisposeJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
    46.  
    47. [C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp line 331]
    48.  
    49. Time: 15:11:49
    50. Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
    51. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    52. Unity.Collections.NativeArray`1<long>:Dispose ()
    53. 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)
    54. 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)
    55. Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
    56. Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
    57. Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
    58. Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
    59. Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
    60. Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)
    61.  
    62. [Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]
    63.  
    64. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    65. [XR] [21528] [15:15:14.068][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_FOCUSED->XR_SESSION_STATE_VISIBLE session=72194947092054017 time=156097959275400
    66. [XR] [21528] [15:15:14.069][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_VISIBLE->XR_SESSION_STATE_SYNCHRONIZED session=72194947092054017 time=156097959278800
    67. [XR] [21528] [15:15:14.069][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_SYNCHRONIZED->XR_SESSION_STATE_STOPPING session=72194947092054017 time=156097959374600
    68. XRTextureManager::RequestDestroyTexture
    69. XRTextureManager::RequestDestroyTexture
    70. XRTextureManager::RequestDestroyTexture
    71. [XR] [21528] [15:15:14.074][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_STOPPING->XR_SESSION_STATE_IDLE session=72194947092054017 time=156097964558000
    72. [XR] [21528] [15:15:36.363][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_IDLE->XR_SESSION_STATE_READY session=72194947092054017 time=156120253913000
    73. [XR] [30780] [15:15:36.392][Error  ] xrBeginFrame: XR_FRAME_DISCARDED
    74. [XR] [21528] [15:15:36.392][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_READY->XR_SESSION_STATE_SYNCHRONIZED session=72194947092054017 time=156120283058600
    75. [XR] [21528] [15:15:36.503][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_SYNCHRONIZED->XR_SESSION_STATE_STOPPING session=72194947092054017 time=156120393817999
    76. [XR] [21528] [15:15:36.504][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_STOPPING->XR_SESSION_STATE_IDLE session=72194947092054017 time=156120394697400
    77.  
    78. Time: 15:15:36
    79. Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
    80. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    81. Unity.Collections.NativeArrayDispose:Dispose ()
    82. Unity.Collections.NativeArrayDisposeJob:Execute ()
    83. Unity.Jobs.IJobExtensions/JobStruct`1<Unity.Collections.NativeArrayDisposeJob>:Execute (Unity.Collections.NativeArrayDisposeJob&,intptr,intptr,Unity.Jobs.LowLevel.Unsafe.JobRanges&,int)
    84.  
    85. [C:\buildslave\unity\build\Runtime/Allocator/ThreadsafeLinearAllocator.cpp line 331]
    86.  
    87. Time: 15:15:36
    88. Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
    89. UnityEngine.StackTraceUtility:ExtractStackTrace ()
    90. Unity.Collections.NativeArray`1<long>:Dispose ()
    91. 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)
    92. 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)
    93. Unity.Rendering.HybridRendererSystem:OnUpdate () (at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157)
    94. Unity.Entities.SystemBase:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400)
    95. Unity.Entities.ComponentSystemGroup:UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583)
    96. Unity.Entities.ComponentSystemGroup:OnUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523)
    97. Unity.Entities.ComponentSystem:Update () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114)
    98. Unity.Entities.ScriptBehaviourUpdateOrder/DummyDelegateWrapper:TriggerUpdate () (at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426)
    99.  
    100. [Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs line 2710]
    101.  
    102. Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak
    103. [XR] [21528] [15:15:37.641][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_IDLE->XR_SESSION_STATE_READY session=72194947092054017 time=156121531788300
    104. [XR] [30780] [15:15:37.668][Error  ] xrBeginFrame: XR_FRAME_DISCARDED
    105. [XR] [21528] [15:15:37.668][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_READY->XR_SESSION_STATE_SYNCHRONIZED session=72194947092054017 time=156121559104100
    106. [XR] [21528] [15:15:37.807][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_SYNCHRONIZED->XR_SESSION_STATE_VISIBLE session=72194947092054017 time=156121698027899
    107. [XR] [21528] [15:15:37.807][Info   ] OpenXRSession::HandleSessionStateChangedEvent: state XR_SESSION_STATE_VISIBLE->XR_SESSION_STATE_FOCUSED session=72194947092054017 time=156121698034600
    108. [XR] [21528] [15:15:37.807][Info   ]
     
    MNNoxMortem likes this.
  2. MNNoxMortem

    MNNoxMortem

    Joined:
    Sep 11, 2016
    Posts:
    723
    Just came here to post this exact same bug :D... and the first thread in the forum I see is yours.

    You beat me to it:
    Code (CSharp):
    1. [Error] Invalid memory pointer was detected in ThreadsafeLinearAllocator::Deallocate!
    2. Unity.Collections.NativeArray`1<long>.Dispose()
    3.  
    4. HybridRendererSystem.UpdateAllBatches() at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2710
    5. 2708:   unreferencedInternalIndices.Dispose();
    6. 2709:   batchRequiresUpdates.Dispose();
    7. -->2710:   batchHadMovingEntities.Dispose();
    8. 2712:   uploadsExecuted.Complete();
    9.  
    10. HybridRendererSystem.UpdateHybridV2Batches() at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2120
    11. 2118:              m_HybridRenderedQuery.CreateArchetypeChunkArray(Allocator.TempJob))
    12. 2119:   {
    13. -->2120:       done = UpdateAllBatches(inputDependencies);
    14. 2121:   }
    15.  
    16. HybridRendererSystem.OnUpdate() at Library/PackageCache/com.unity.rendering.hybrid@0.51.0-preview.32/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:2157
    17. 2156:   Profiler.BeginSample("UpdateHybridV2Batches");
    18. -->2157:   done = UpdateHybridV2Batches(Dependency);
    19. 2158:   Profiler.EndSample();
    20.  
    21. SystemBase.Update() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/SystemBase.cs:400
    22. 398:   try
    23. 399:   {
    24. -->400:       OnUpdate();
    25. 401:   }
    26. 402:   catch
    27.  
    28. ComponentSystemGroup.UpdateAllSystems() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:583
    29. 581:           // Update managed code.
    30. 582:           var sys = m_systemsToUpdate[index.Index];
    31. -->583:           sys.Update();
    32. 584:       }
    33. 585:   }
    34.  
    35. ComponentSystemGroup.OnUpdate() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystemGroup.cs:523
    36. 521:   if (RateManager == null)
    37. 522:   {
    38. -->523:       UpdateAllSystems();
    39. 524:   }
    40. 525:   else
    41.  
    42. ComponentSystem.Update() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ComponentSystem.cs:114
    43. 112:   try
    44. 113:   {
    45. -->114:       OnUpdate();
    46. 115:   }
    47. 116:   finally
    48.  
    49. ScriptBehaviourUpdateOrder/DummyDelegateWrapper.TriggerUpdate() at Library/PackageCache/com.unity.entities@0.51.0-preview.32/Unity.Entities/ScriptBehaviourUpdateOrder.cs:426
    50. 424:       if (m_System.m_StatePtr != null)
    51. 425:       {
    52. -->426:           m_System.Update();
    53. 427:       }
    54. 428:   }
    55.  
    Bug Report: IN-10395

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

    mk1987

    Joined:
    Mar 18, 2019
    Posts:
    53
    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!
     
    MNNoxMortem likes this.
  4. linfuqing

    linfuqing

    Joined:
    May 11, 2015
    Posts:
    166