Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug BatchRendererGroupMetadataCache::Search() Crash

Discussion in 'Graphics for ECS' started by julian-moschuering, Sep 5, 2023.

  1. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    Unity 2022.3.8f1

    We have a crash on WinDX11, WinDX12, XSS and XSX (probably all plattforms). Deactivating graphics jobs (gfx-enable-gfx-jobs=0) 'works'. Seems highly timing related, eg preloading resources can prevent it. Looks like some kind of unguarded access on shared memory. PlayInEditor never had any issues so far.

    It wasn't possible to isolate this issue so far. Any information is quiet welcome.

    Unhandled exception at 0x00007FFCF66BF523 (UnityPlayer.dll) in Dungeons 4.exe: 0xC0000005: Access violation reading location 0x0000000051307EAD.
    Callstack
    Code (CSharp):
    1.     core::hash_set<struct core::pair<struct MetadataCBuffersKey const ,struct MetadataCBuffers *,0>,struct core::hash_pair<struct BatchMetadataCBuffersKeyHash,struct MetadataCBuffersKey const ,struct MetadataCBuffers *>,struct core::equal_pair<struct std::equal_to<struct MetadataCBuffersKey>,struct MetadataCBuffersKey const ,struct MetadataCBuffers *> >::lookup<struct MetadataCBuffersKey,struct core::equal_pair<struct std::equal_to<struct MetadataCBuffersKey>,struct MetadataCBuffersKey const ,struct MetadataCBuffers *> >(struct MetadataCBuffersKey const &,struct core::equal_pair<struct std::equal_to<struct MetadataCBuffersKey>,struct MetadataCBuffersKey const ,struct MetadataCBuffers *> const &)    Unknown
    2.     UnityPlayer.dll!BatchRendererGroupMetadataCache::Search(class BatchID const &,class Shader &)    Unknown
    3.     UnityPlayer.dll!BatchRendererGroupMetadataCacheContext::CacheSearcher::Search(class BatchID const &,class Shader &)    Unknown
    4.     UnityPlayer.dll!ScriptableBatchRenderer::RenderMultipleMeshes(class RenderNodeQueue const &,struct BatchInstanceDataSRPB const *,int,class VertexInputMasks)    Unknown
    5.     UnityPlayer.dll!ScriptableBatchRenderer::Flush(enum BatchBreakCause)    Unknown
    6.     UnityPlayer.dll!ScriptableRenderLoopDrawSRPBatcher(struct ScriptableLoopObjectData const *,unsigned __int64,struct SharedRendererScene const &,struct DrawRenderersCommand const &,struct ShaderPassContext &,class GfxDevice &,int,class BatchRendererGroupMetadataCacheContext const *)    Unknown
    7.     UnityPlayer.dll!ScriptableRenderLoopJob()    Unknown
    8.     UnityPlayer.dll!ExecuteAsyncSetup()    Unknown
    9.     UnityPlayer.dll!ujob_execute_job()    Unknown
    10.     UnityPlayer.dll!lane_guts()    Unknown
    11.     UnityPlayer.dll!worker_thread_routine()    Unknown
    12.     UnityPlayer.dll!Thread::RunThreadWrapper(void *)    Unknown
    13.     kernel32.dll!00007ff916a026ad()    Unknown
    14.     ntdll.dll!00007ff916e0aa68()    Unknown

    Seems related: https://forum.unity.com/threads/vulkan-batchrenderergroupmetadatacache-search-crash.1461908/
     
  2. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    We have received some reports of a very similar crash, usually accompanied by a log warning such as
    The issue seems to typically happen if there are several full renders during a frame (for example, in the editor, or possibly a manual camera rendering), and the first rendering has long-running jobs for some reason.

    There is a fix for this already in the pipeline, and it should be coming in a future release, but I can't provide an exact version yet.
     
    julian-moschuering and JesOb like this.
  3. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    Definitely the case.

    Okay, thank you.
     
  4. julian-moschuering

    julian-moschuering

    Joined:
    Apr 15, 2014
    Posts:
    529
    @JussiKnuuttila Is there an issue for us to track the status of this issue/fix?
     
  5. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    I don't think there is a public issue number as the issue was first created internally, but I can update this thread as soon as the fix lands.
     
    apkdev and julian-moschuering like this.
  6. JussiKnuuttila

    JussiKnuuttila

    Unity Technologies

    Joined:
    Jun 7, 2019
    Posts:
    351
    The fix for this issue has landed in 2022.3.10f1, 2023.1.14f1, 2023.2.0b10, and 2023.3.0a6.