Search Unity

Bug GfxDeviceGLES::DrawBuffersBatchMode agony

Discussion in 'VR' started by LucasHehir, Apr 3, 2023.

  1. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    Just came off the back of a very stressful VR dev cycle. We used OVR SDK 46~49 with Unity 2022.2 and successfully employed Passthrough layers, Scene API and Addressables to handle additive scene loading. It worked mostly well, great performance, no apparent memory leaks, however...

    The overwhelming majority of our crashes (all but one) were caused by a very low-level and non-descript native crash leading back to libc.so and libunity.so. The stacktrace found on Cloud Diagnostics always looks identical:

    Native StackTrace:
    Thread 0 (crashed)
    0 libc.so 0x0000007bbdcbfe7c <symbols missing for uuid: 76160b7be02961a2e357c92bde57eb19>
    1 libunity.so 0x0000007ad62c9838 GfxDeviceGLES:: DrawBuffersBatchMode(GfxBatchHeader const&)
    2 libunity.so 0x0000007ad647e840 GfxDeviceWorker::RunCommand(ThreadedStreamBuffer&)
    3 libunity.so 0x0000007ad6477174 GfxDeviceWorker::RunExt(ThreadedStreamBuffer&)
    4 libunity.so 0x0000007ad6476eec GfxDeviceWorker::RunGfxDeviceWorker(void*)
    5 libunity.so 0x0000007ad5d1c5b0 Thread::RunThreadWrapper(void*)
    6 libc.so 0x0000007bbdd17c44 <symbols missing for uuid: 76160b7be02961a2e357c92bde57eb19>
    7 libc.so 0x0000007bbdcc4fe4 <symbols missing for uuid: 76160b7be02961a2e357c92bde57eb19>

    libc.so is an Android library so symbols for it aren't attainable, but the failure point seems to be the preceding GfxDeviceGLES:: DrawBuffersBatchMode invocation.

    In practice, the crash can occur at any time during execution and thus is not entirely reproducible (there is no clearly offending scene, model, material or shader that triggers it). The likelihood does seem to go up in scenes with a higher quantity of total 3D assets, but this is fairly anecdotal and can happen in very sparse scenes as well.

    Various theories have been put forward including the specific major and minor release of the Unity engine, but the bug appears to be persistent through 2021.3~2022.2. The crash is clearly rendering-related but we could be guessing at various settings/failure points for a very long time.

    I even put the stack trace to GPT-4 and it reported there wasn't enough information to specify a cause. The most likely suggestion was an out-of-bounds pointer for DrawBuffersBatchMode.

    Any ideas or insight are extremely welcome.
     
    Last edited: Apr 4, 2023
    fhn-oncomfort and YVR_WXJ like this.
  2. fhn-oncomfort

    fhn-oncomfort

    Joined:
    Jan 14, 2022
    Posts:
    4
    I have the same crash on Unity 2021.2.0f1 and I'm using URP 11. (Building for Android 8 on a Pico G2 VR headset)
    In my case it seems to sometime crash after loading a specific scene.

    The closest issue I found was this crash happening on Linux Editor: https://issuetracker.unity3d.com/is...les-drawbuffersbatchmode-when-loading-a-scene

    From this release note it seemed to be related to OpenGL + SRP Batcher + async shader compilation.

    Did you tried to disable SRP Batcher ? (Assuming you use URP).
     
    LucasHehir likes this.
  3. LucasHehir

    LucasHehir

    Joined:
    May 7, 2020
    Posts:
    74
    We are using URP but I haven't tried disabling the Batcher yet. I'll give that a go, thank you!
     
  4. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    23

    hi,if you found a specific scene to reproduce this issue, could you submit a bug for this.

    We also suffering from this crash, but we didn't found a minimum project to reproduce it.


    And have you tried whether turn off async script compilation will help to workaround this issue.As turn off batcher may lead to noticeable performance drop.
     
  5. fhn-oncomfort

    fhn-oncomfort

    Joined:
    Jan 14, 2022
    Posts:
    4
    It seems that I did fix the issue but I disabled both the Dynamic batcher and the SRP batcher.
    In my case I even had a performance improvement.
    Dynamically batching meshes is always a computing tradeoff between CPU and GPU and it's not always better to have it enabled.

    Turning off Async Shader Compilation won't do anyting since it's an Editor feature and my crash occure in build.

    The crash was not happening all the time and only after 18 min of testing in a specific setup. It's hard to isolate it to make an easy reproductible report.

    But I guess OpenGL 3 have an issue with dynamic batching, I don't know if it come from the dynamic batcher or the SRP batcher (Both are probably calling the same API in OpenGL anyway).

    You should use Vulkan if your target device support it. In my case i'm stuck with OpenGL 3.1 for the moment.
     
    Last edited: Apr 13, 2023
  6. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    23
    Really thanks for these information!

    We also stuck with EGL 3 as some native plugin we used are writing with EGL...
     
  7. npestov

    npestov

    Joined:
    Feb 7, 2018
    Posts:
    10
    Did you find a solution?
     
  8. Tuncle

    Tuncle

    Joined:
    Oct 1, 2018
    Posts:
    23
    Try to turn off dynamic batching
     
  9. IgorGalimskiy

    IgorGalimskiy

    Joined:
    May 30, 2017
    Posts:
    31
    We have dynamic batching off, but still see this crash on Unity 2021.3.26