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
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)
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.
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?
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.
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?
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.
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