There is a bug and the crash in libGLESv2_mtk.so on some devices

We have a crash after 5-7 minutes app running on devices (Nokia C30, Vivo Y12, Samsung A12) where this error spams:
glClientWaitSync: Expected application to have kicked everything until job: x (possibly by calling glFlush)

It’s also spamming in empty unity URP project, but there is no crash.
After 5 minutest on empty project this log changes to another spamming log
E IMGSRV : :1248: CBUF_GetBufferSpace: Run out of space in the CBUF:SCISSOR buffer, with no outstanding HW ops
E IMGSRV : :3103: PrepareToDrawSetupDrawSurfaceScissor failed
E IMGSRV : :2503: DoClear: Can’t prepare to draw

But my project is just crashes

java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version ‘2021.2.10f1 (ee872746220e)’, Build type ‘Release’, Scripting Backend ‘il2cpp’, CPU ‘arm64-v8a’
Build fingerprint: ‘vivo/1904_RU/1904:11/RP1A.200720.012/compiler1222175223:user/release-keys’
Revision: ‘0’
ABI: ‘arm64’
Timestamp: 2022-03-11 18:23:01+0500
pid: 7939, tid: 8158, name: Thread-105 >>> com.lucysville.merge <<<
uid: 10822
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
x0 b40000781351e2c0 x1 0000000000000000 x2 b4000075e882ffa8 x3 0000000000000002
x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 b400007813554138
x8 0000000000000000 x9 b4000075e89c8600 x10 0000000000001702 x11 b400007813521820
x12 000000002f297fa0 x13 b4000078134ff2b0 x14 b40000781589eec0 x15 0000000090000002
x16 000000780552cb28 x17 00000078a958a7f0 x18 00000076991ca000 x19 0000000000000000
x20 b40000781351e2c0 x21 b4000075e882ffa8 x22 0000000000000001 x23 0000000000000000
x24 b400007813525918 x25 b400007813525900 x26 0000000000010000 x27 0000000000000000
x28 0000000000002713 x29 0000007699a69550
sp 0000007699a69520 lr 00000078046e6824 pc 00000078047200cc

backtrace:
#00 pc 000000000019b0cc /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: 0766026ea47432c88b0df4b920c12ffd)
#01 pc 0000000000161820 /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: 0766026ea47432c88b0df4b920c12ffd)

at libGLESv2_mtk.0x19b0cc(Native Method)
at libGLESv2_mtk.0x161820(Native Method)

I tried to parse this crash with ndk-stack but have no idea where can I get unstrippet /libGLESv2_mtk.so lib.

Looking for any advice in solving of this problem…

2 Likes

FYI we can reproduce this crash and are looking into it. I don’t have a public bug tracker link yet.

Hello. We have a crash after 5-7 minutes app running on device (Lenovo Tab M7 (3rd Gen))

Caused by java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version ‘2021.2.8f1 (d0e5f0a7b06a)’, Build type ‘Release’, Scripting Backend ‘il2cpp’, CPU ‘armeabi-v7a’
Build fingerprint: ‘Lenovo/LenovoTB-7306F_EGO/7306F:11/RP1A.200720.011/S000040_220329_ROW:user/release-keys’
Revision: ‘0’
ABI: ‘arm’
Timestamp: 2022-06-02 16:54:44+0100
pid: 18375, tid: 18497, name: UnityGfxDeviceW >>> com.WiB.LiveFactory <<<
uid: 10184
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
r0 69832d40 r1 00000000 r2 6207e718 r3 00000002
r4 69837acc r5 00000000 r6 00000000 r7 67591c58
r8 6207e718 r9 69832d40 r10 61938000 r11 00000002
ip 8a074464 sp 67591c08 lr 89463f3b pc 894932e2

backtrace:
#00 pc 001452e2 /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
#01 pc 00115f37 /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
#02 pc 00084e9d /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
#03 pc 00085405 /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
#04 pc 004fba70 /data/app/~~BYD9_tEoOfUGIN99wQhX-A==/com.WiB.LiveFactory-YNWRhrHlAPjOg0sinj9rsQ==/lib/arm/libunity.so (BuildId: bf23fdcade946bcd57c70be76d1d6fea7160ff5e)
#05 pc 004f0f54 /data/app/~~BYD9_tEoOfUGIN99wQhX-A==/com.WiB.LiveFactory-YNWRhrHlAPjOg0sinj9rsQ==/lib/arm/libunity.so (BuildId: bf23fdcade946bcd57c70be76d1d6fea7160ff5e)
#06 pc 0050cb70 /data/app/~~BYD9_tEoOfUGIN99wQhX-A==/com.WiB.LiveFactory-YNWRhrHlAPjOg0sinj9rsQ==/lib/arm/libunity.so (BuildId: bf23fdcade946bcd57c70be76d1d6fea7160ff5e)
#07 pc 004eb59c /data/app/~~BYD9_tEoOfUGIN99wQhX-A==/com.WiB.LiveFactory-YNWRhrHlAPjOg0sinj9rsQ==/lib/arm/libunity.so (BuildId: bf23fdcade946bcd57c70be76d1d6fea7160ff5e)
#08 pc 0061d3d3 /data/app/~~BYD9_tEoOfUGIN99wQhX-A==/com.WiB.LiveFactory-YNWRhrHlAPjOg0sinj9rsQ==/lib/arm/libunity.so (BuildId: bf23fdcade946bcd57c70be76d1d6fea7160ff5e)
<truncated: 668 chars>
at libGLESv2_mtk.0x1452e2()
at libGLESv2_mtk.0x115f37()
at libGLESv2_mtk.0x84e9d()
at libGLESv2_mtk.0x85405()
at libunity.0x4fba70()
at libunity.0x4f0f54()
at libunity.0x50cb70()
at libunity.0x4eb59c()
at libunity.0x61d3d3()
at libunity.0x6237af()
at libunity.0x61ced7()
at libunity.0x1b2543()
at libc.__unregister_atfork(__unregister_atfork:26)

and

Caused by java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version ‘2021.2.8f1 (d0e5f0a7b06a)’, Build type ‘Release’, Scripting Backend ‘il2cpp’, CPU ‘arm64-v8a’
Build fingerprint: ‘realme/RMX3201RU/RMX3201:11/RP1A.200720.011/1647615937768:user/release-keys’
Revision: ‘0’
ABI: ‘arm64’
Timestamp: 2022-06-04 13:44:43+0300
pid: 19886, tid: 19980, name: UnityGfxDeviceW >>> com.WiB.LiveFactory <<<
uid: 10498
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
x0 b400007965a33200 x1 0000000000000000 x2 b4000079603dcb28 x3 0000000000000002
x4 0000000000000000 x5 0000000000000000 x6 0000000000000000 x7 b400007965a9e138
x8 0000000000000000 x9 b400007948f6d200 x10 0000000000001702 x11 b400007965a36760
x12 b400007965a258a0 x13 b4000079465a6110 x14 b40000798d3f56c0 x15 0000000090000002
x16 0000007abea2db28 x17 0000007b616a1c68 x18 0000007963458000 x19 0000000000000000
x20 b400007965a33200 x21 b4000079603dcb28 x22 0000000000000001 x23 0000000000000000
x24 b400007965a3a858 x25 b400007965a3a840 x26 0000000000010000 x27 0000000000000000
x28 0000000000002713 x29 00000079638cf550
sp 00000079638cf520 lr 0000007abd6277c8 pc 0000007abd6610fc

backtrace:
#00 pc 000000000019b0fc /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: d43aa4d5213661a7778207ecd233646a)
#01 pc 00000000001617c4 /vendor/lib64/egl/libGLESv2_mtk.so (BuildId: d43aa4d5213661a7778207ecd233646a)

at libGLESv2_mtk.0x19b0fc()
at libGLESv2_mtk.0x1617c4()

Any update here? We see same crash in 2021.3.4f1…

In our experiments it helps to call glFinish roughly every 1000 frames (or more often but it‘s expensive because it stalls the GPU).
You could try that using a native rendering plugin.
We got some more information about when affected drivers leak some memory that causes this. We will look into that to maybe come up with a better workaround.

I had to disable about 50 devices in Google Play because of this error. Because they create crashes above the norm. Most crashes occur on devices with processors: Mediatek MT6765, Spreadtrum SC9863A. But there are many other devices that rarely generate crashes. In this case, in total it turns out enough to overcome 1% of the permissible errors. This is very sad. I’m crying.

Devices with UnityGfxDeviceW error




Hello,

We are experiencing the same crash on Mediatek MT6765 devices.
Is there any progress on a bugfix? (Using 2021.3.0f1)

Thank you!

same here! is there any solution for this?

Adding more info. We have just release a new update using Unity 2021.3.0f1.

Out of all the crashes reported by Unity Analytics 33% are libglesv2_mtk.so crashes.
They all happen on PowerVR Rogue GE8320 chipsets.
Top crashing devices: Realme C15, Vivo Y3s, TCL A3, Moto G Pure, LGE LM-K500

Our previous update was released with 2021.1.15f1 and these crashes were not present, I have double-checked this. I am providing this detail so maybe it can help you backtrack the code changes that triggered this unwanted behavior.

Could we get a a public bug tracker link, and ETA maybe or the native render plugin code you propose that would alleviate this issue?

Thank you

The root cause is a bug in the PowerVR driver where draw calls that the driver optimizes out leak some memory. That memory bufffer has a fixed size per framebuffer (RenderTexture) and running out of that memory causes the crash. A single draw call that is not optimized out reclaims the leaked memory, so this only leads to a problem if all draws to the same framebuffer (across multiple frames) are redundant.

We found that a depth-only clear to a 1x1 depth RenderTexture in URP that happens every frame also triggers this.

I do not have a bug report that uses built-in render pipeline but any custom code could also trigger the problem.

We will fix the case of the 1x1 depth-only clear asap but at this point we have not made a decision if we will implement a general workaround for the driver bug for all scenarios because some of those seem rather unlikely and the workaround won‘t be free.

I don‘t have an ETA.

2 Likes

Issue tracker link: Unity Issue Tracker - [Android] URP Project crashes when built on a device with PowerVR Rogue GE8320 GPU

Does anyone hit this issue without using URP? Another repro project would be helpful for us to figure which cases a workaround needs to cover.

Could you describe a bit, what was the reason to add that 1x1 depth texture at all, into pipeline, have no info about that trick?
And is there easy way to remove it, or at least change clear flags to Color+Z+Stencil, which in my opinion also should fix issue, without modifying URP and core packages?

built in pipeline
Unity 2019.4.40f1/Unity 2018.4.36f1/Unity2021.3.4f1
new 2D project
Device Model: moto g pure
Android 11

I think this is what you want!
https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-9851

1 Like

As far as I know the 1x1 depth texture is used by URP in some cases to limit the total number of shader variants.
It essentially depends on URP settings and which variants are stripped.

Having the same issue here.
Hope it’s solved soon.

Hi, someone tested the version 2021.3.10 ? The release notes seems to say that the bug is fixed.

We have released our game update build with Unity 2021.3.10 and there is already one “libGLESv2_mtk” crash reported in Google Play Console (1 out of 100 users so 1% crash rate). There is not enough data yet, but it doesn’t seem to be fixed completely, or it might be different issue.

Here is the crash report:

Exception java.lang.Error: FATAL EXCEPTION [main]
Unity version     : 2021.3.10f1
Device model      : WIKO W-K610-FRA
Device fingerprint: WIKO/W-K610-FRA/W-K610:11/RP1A.200720.011/09071102:user/release-keys
Build Type        : Release
Scripting Backend : IL2CPP
ABI               : armeabi-v7a
Strip Engine Code : true

Caused by: java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Version '2021.3.10f1 (1c7d0df0160b)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'armeabi-v7a'
Build fingerprint: 'WIKO/W-K610-FRA/W-K610:11/RP1A.200720.011/09071102:user/release-keys'
Revision: '0'
ABI: 'arm'
Timestamp: 2022-09-28 07:59:46+0200
pid: 24297, tid: 24534, name: UnityGfxDeviceW  >>> *REMOVED* <<<
uid: 10188
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
Cause: null pointer dereference
    r0  8b607540  r1  00000000  r2  8c0de340  r3  00000002
    r4  8b60c2cc  r5  8c0de340  r6  00000000  r7  65e33c58
    r8  ffffffff  r9  8b607540  r10 8b842000  r11 00000002
    ip  8c171464  sp  65e33c08  lr  8b46ef89  pc  8b49e2e2

backtrace:
      #00 pc 001452e2  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
      #01 pc 00115f85  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
      #02 pc 00084e9d  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
      #03 pc 00085405  /vendor/lib/egl/libGLESv2_mtk.so (BuildId: f7350dfe211607f3e4c69331c3d75542)
      #04 pc 004f1930  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #05 pc 004e6bc8  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #06 pc 00503578  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #07 pc 004e101c  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #08 pc 0061e39b  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #09 pc 00624777  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #10 pc 0061de9f  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #11 pc 001a5a7b  /data/app/~~49HJ34gg51j_AUE4hxlVIw==/*-Js0RHR_JMR1yakmkcUlCgA==/lib/arm/libunity.so (BuildId: 833613835c0f17690cbbf3f96443196a17669962)
      #12 pc 000a9be3  /apex/com.android.runtime/lib/bionic/libc.so (__unregister_atfork+26) (BuildId: 6a24d276a45a50f2b3001b261bd2c63a)
  at libGLESv2_mtk
  at libGLESv2_mtk
  at libGLESv2_mtk
  at libGLESv2_mtk
  at libunity
  at libunity
  at libunity
  at libunity
  at libunity
  at libunity
  at libunity
  at libunity
  at libc.__unregister_atfork (libc.java:26)

I am actually using built in render right now, updated to 2021.3.10 but without URP this time.
Also unchecking “Optimized Frame Pacing” solved some serious freezing on older devices after some time