GLSurfaceView onPause ANR问题

  • Creator 版本:2.1.1

  • 目标平台: Android

  • 详细报错信息,包含调用堆栈:
    “main” prio=5 tid=1 Blocked
    | group=“main” sCount=1 dsCount=0 flags=1 obj=0x766d71f0 self=0xa9a90c00
    | sysTid=18950 nice=0 cgrp=default sched=0/0 handle=0xae982494
    | state=S schedstat=( 0 0 0 ) utm=469 stm=216 core=3 HZ=100
    | stack=0xbe210000-0xbe212000 stackSize=8MB
    | held mutexes=
    #00 pc 0000000000019f4c /system/lib/libc.so (syscall+28)
    #01 pc 00000000000a7393 /system/lib/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+78)
    #02 pc 00000000002d5e2f /system/lib/libart.so (_ZN3art7Monitor4LockILNS_10LockReasonE0EEEvPNS_6ThreadE+3466)
    #03 pc 00000000002d75e1 /system/lib/libart.so (art::Monitor::Wait(art::Thread*, long long, int, bool, art::ThreadState)+1028)
    #04 pc 00000000002d8915 /system/lib/libart.so (art::Monitor::Wait(art::Thread*, art::mirror::Object*, long long, int, bool, art::ThreadState)+284)
    #05 pc 00000000002ece91 /system/lib/libart.so (art::Object_wait(_JNIEnv*, _jobject*)+32)
    at java.lang.Object.wait (Native method)

  • waiting to lock <0x0de0a1c0> (a android.opengl.GLSurfaceView$GLThreadManager) held by thread 35
    at android.opengl.GLSurfaceView$GLThread.onPause (GLSurfaceView.java:1723)
  • locked <0x0de0a1c0> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView.onPause (GLSurfaceView.java:578)
    at org.cocos2dx.lib.Cocos2dxGLSurfaceView.onPause (Cocos2dxGLSurfaceView.java:132)
    at org.cocos2dx.lib.Cocos2dxActivity.onPause (Cocos2dxActivity.java:371)
    at org.cocos2dx.javascript.AppActivity.onPause (AppActivity.java:182)
    at android.app.Activity.performPause (Activity.java:7622)
    at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1469)
    at android.app.ActivityThread.performPauseActivityIfNeeded (ActivityThread.java:4262)
    at android.app.ActivityThread.performPauseActivity (ActivityThread.java:4227)
    at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:4179)
    at android.app.servertransaction.PauseActivityItem.execute (PauseActivityItem.java:45)
    at android.app.servertransaction.TransactionExecutor.executeLifecycleState (TransactionExecutor.java:145)
    at android.app.servertransaction.TransactionExecutor.execute (TransactionExecutor.java:70)
    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1960)
    at android.os.Handler.dispatchMessage (Handler.java:106)
    at android.os.Looper.loop (Looper.java:214)
    at android.app.ActivityThread.main (ActivityThread.java:7097)
    at java.lang.reflect.Method.invoke (Native method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:494)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:975)
    “GLThread 90604” tid=35 Native
    “GLThread 90604” prio=5 tid=35 Native
    | group=“main” sCount=1 dsCount=0 flags=1 obj=0x13f80040 self=0xa44f7000
    | sysTid=19074 nice=0 cgrp=default sched=0/0 handle=0x8b325970
    | state=S schedstat=( 0 0 0 ) utm=1311 stm=4917 core=3 HZ=100
    | stack=0x8b222000-0x8b224000 stackSize=1042KB
    | held mutexes=
    #00 pc 0000000000060d08 /system/lib/libc.so (__ioctl+8)
    #01 pc 00000000000226bf /system/lib/libc.so (ioctl+30)
    #02 pc 00000000000beb85 /vendor/lib/libgsl.so (gsl_ldd_control+176)
    #03 pc 00000000000bfe29 /vendor/lib/libgsl.so (ioctl_kgsl_cmdstream_waittimestampevent+76)
    #04 pc 00000000000bdc4b /vendor/lib/libgsl.so (gsl_linux_context_waittimestamp+118)
    #05 pc 0000000000009791 /vendor/lib/libgsl.so (gsl_command_waittimestamp+180)
    #06 pc 00000000001b1ab1 /vendor/lib/egl/libGLESv2_adreno.so (EsxCmdMgr::WaitForTimestampInternal(EsxTimestamp const*, EsxContext*)+604)
    #07 pc 00000000001bff0d /vendor/lib/egl/libGLESv2_adreno.so (EsxGfxMem::WaitOnTimestamp(EsxContext const*) const+52)
    #08 pc 00000000001bfd43 /vendor/lib/egl/libGLESv2_adreno.so (EsxGfxMem::Destroy(EsxContext*)+126)
    #09 pc 000000000019bb75 /vendor/lib/egl/libGLESv2_adreno.so (EglWindowSurface::Destroy()+208)
    #10 pc 0000000000189339 /vendor/lib/egl/libGLESv2_adreno.so (EglApi::DestroySurface(void*, void*)+108)
    #11 pc 000000000000d08f /system/lib/libEGL.so (eglDestroySurface+54)
    #12 pc 00000000000752e1 /system/lib/libandroid_runtime.so (android::jni_eglDestroySurface(_JNIEnv*, _jobject*, _jobject*, _jobject*)+76)
    at com.google.android.gles_jni.EGLImpl.eglDestroySurface (Native method)
    at android.opengl.GLSurfaceView$DefaultWindowSurfaceFactory.destroySurface (GLSurfaceView.java:848)
    at android.opengl.GLSurfaceView$EglHelper.destroySurfaceImp (GLSurfaceView.java:1189)
    at android.opengl.GLSurfaceView$EglHelper.destroySurface (GLSurfaceView.java:1179)
    at android.opengl.GLSurfaceView$GLThread.stopEglSurfaceLocked (GLSurfaceView.java:1285)
    at android.opengl.GLSurfaceView$GLThread.guardedRun (GLSurfaceView.java:1367)
  • locked <0x0de0a1c0> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView$GLThread.run (GLSurfaceView.java:1270)

这个ANR只发生在Android9,只有这两种机型
j6primelte 224 99.6%
j4primelte 1 0.4%

求解。。。。