Is there any solution of ANR?

Is there any solution of ANR? @slackmoehrle
i have a bunch of ANRs in Google’s developer console

Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50000010 }

“main” prio=5 tid=1 Waiting
| group=“main” sCount=1 dsCount=0 obj=0x74312380 self=0xb4d76500
| sysTid=8911 nice=-4 cgrp=default sched=0/0 handle=0xb6f28c00
| state=S schedstat=( 0 0 0 ) utm=183 stm=51 core=2 HZ=100
| stack=0xbe2e2000-0xbe2e4000 stackSize=8MB
| held mutexes=
at java.lang.Object.wait! (Native method)

  • waiting on <0x0fbb3177> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView$GLThread.surfaceDestroyed (GLSurfaceView.java:1643)
  • locked <0x0fbb3177> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView.surfaceDestroyed (GLSurfaceView.java:533)
    at android.view.SurfaceView.updateWindow (SurfaceView.java:566)
    at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:239)
    at android.view.View.dispatchWindowVisibilityChanged (View.java:9656)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1311)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1311)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1311)
    at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1383)
    at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1107)
    at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6013)
    at android.view.Choreographer$CallbackRecord.run (Choreographer.java:902)
    at android.view.Choreographer.doCallbacks (Choreographer.java:714)
    at android.view.Choreographer.doFrame (Choreographer.java:648)
    at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:888)
    at android.os.Handler.handleCallback (Handler.java:739)
    at android.os.Handler.dispatchMessage (Handler.java:95)
    at android.os.Looper.loop (Looper.java:148)
    at android.app.ActivityThread.main (ActivityThread.java:5523)
    at java.lang.reflect.Method.invoke! (Native method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:799)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:689)

Input dispatching timed out (Waiting to send key event because the focused window has not finished processing all of the input events that were previously delivered to it. Outbound queue length: 0. Wait queue length: 2.)

“main” prio=5 tid=1 Waiting
| group=“main” sCount=1 dsCount=0 obj=0x756f9eb8 self=0xeb284400
| sysTid=29261 nice=-4 cgrp=default sched=0/0 handle=0xedecf534
| state=S schedstat=( 1055080476 96034745 1475 ) utm=74 stm=31 core=2 HZ=100
| stack=0xff72d000-0xff72f000 stackSize=8MB
| held mutexes=
at java.lang.Object.wait! (Native method)

  • waiting on <0x0149735e> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView$GLThread.surfaceDestroyed (GLSurfaceView.java:1689)
  • locked <0x0149735e> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView.surfaceDestroyed (GLSurfaceView.java:533)
    at android.view.SurfaceView.updateWindow (SurfaceView.java:607)
    at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:256)
    at android.view.View.dispatchWindowVisibilityChanged (View.java:10278)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1289)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1289)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1289)
    at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1579)
    at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1291)
    at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:6357)
    at android.view.Choreographer$CallbackRecord.run (Choreographer.java:873)
    at android.view.Choreographer.doCallbacks (Choreographer.java:685)
    at android.view.Choreographer.doFrame (Choreographer.java:621)
    at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:859)
    at android.os.Handler.handleCallback (Handler.java:751)
    at android.os.Handler.dispatchMessage (Handler.java:95)
    at android.os.Looper.loop (Looper.java:154)
    at android.app.ActivityThread.main (ActivityThread.java:6195)
    at java.lang.reflect.Method.invoke! (Native method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:874)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:764)
2 Likes

@drelaptop do we have a resolution to this yet? There is another ANR thread too.

What device and android version this ANR occurs ? I will try to make my time free, and to research the both ANR issues.

I don’t think this happens on pixel 2 or Vivo x20 or Galaxy Tab 9. Maybe device specific like you think?

yes, I prefer to think device specific or android version specific.

Audio is platform and device related.

My devices run android 6 and 7 only. No 8 yet.

@drelaptop @slackmoehrle
Input dispatching timed out

Samsung Galaxy J5 Prime (on5xelte), Android 7.0

Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50000010 }

Itel itel A11 (itel_A11), Android 6.0
Evercoss U50 (U50), Android 6.0
Itel A41 Plus (itel_A41Plus), Android 6.0
Intex Aqua_Lions_4G (INTEX_AQUA_LIONS_4G), Android 6.0
Lava A77 (A77), Android 6.0
sp9832a_2h11_volte, Android 6.0
Lava Xolo era 2 (era_2), Android 6.0

Hi there @slackmoehrle !
I’m getting a bunch of these anrs too. I’m using cocos2d-x 3.16.

FYI, I’m getting them on surfaceDestroyed and also on onPause of the GLSurfaceView.

Any suggestions?

Hey! Sorry to bother you again @slackmoehrle, but I have almost a 1% sessions with ANR and all of them have similar traces to the ones posted in this thread. Any progress on this?

@fryderyk88 Thanks. Can you e-mail me with your particular details? I can pass along to the engineering team. I know this issue has been cropping up but hard to isolate. The more info they have the better. slackmoehrle@cocos2d-x.org

@drelaptop any thoughts how we help solve this. Some users are telling me they are down 50% maybe because of this:

__ We have lost almost 50% of profile visualizations, which causes a 50% lost of downloads, aprox. Maybe having a bad ANR rate is the cause, we don’t know.__

Hi! i have same ANR report here!
Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50000010 (has extras) }
“main” prio=5 tid=1 Waiting
| group=“main” sCount=1 dsCount=0 obj=0x76788598 self=0xb86c6718
| sysTid=11517 nice=0 cgrp=default sched=0/0 handle=0xb6fe8b4c
| state=S schedstat=( 4615028597 3082583697 13879 ) utm=318 stm=143 core=0 HZ=100
| stack=0xbe10e000-0xbe110000 stackSize=8MB
| held mutexes=
at java.lang.Object.wait! (Native method)

  • waiting on <0x06fecbaa> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView$GLThread.surfaceDestroyed (GLSurfaceView.java:1755)
  • locked <0x06fecbaa> (a android.opengl.GLSurfaceView$GLThreadManager)
    at android.opengl.GLSurfaceView.surfaceDestroyed (GLSurfaceView.java:638)
    at android.view.SurfaceView.updateWindow (SurfaceView.java:704)
    at android.view.SurfaceView.onWindowVisibilityChanged (SurfaceView.java:322)
    at android.view.View.dispatchWindowVisibilityChanged (View.java:10454)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1330)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1330)
    at android.view.ViewGroup.dispatchWindowVisibilityChanged (ViewGroup.java:1330)
    at android.view.ViewRootImpl.performTraversals (ViewRootImpl.java:1841)
    at android.view.ViewRootImpl.doTraversal (ViewRootImpl.java:1528)
    at android.view.ViewRootImpl$TraversalRunnable.run (ViewRootImpl.java:7530)
    at android.view.Choreographer$CallbackRecord.run (Choreographer.java:911)
    at android.view.Choreographer.doCallbacks (Choreographer.java:686)
    at android.view.Choreographer.doFrame (Choreographer.java:622)
    at android.view.Choreographer$FrameDisplayEventReceiver.run (Choreographer.java:897)
    at android.os.Handler.handleCallback (Handler.java:739)
    at android.os.Handler.dispatchMessage (Handler.java:95)
    at android.os.Looper.loop (Looper.java:148)
    at android.app.ActivityThread.main (ActivityThread.java:7325)
    at java.lang.reflect.Method.invoke! (Native method)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1230)
    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1120)
    can anyone help me about this?
    thanks!

I see that the call to the parent on pause is commented out:

@Override
public void onPause() {
    this.queueEvent(new Runnable() {
        @Override
        public void run() {
            Cocos2dxGLSurfaceView.this.mCocos2dxRenderer.handleOnPause();
        }
    });
    this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    //super.onPause();
}

Maybe this is the reason for th bug?

the hack code was fixed at https://github.com/cocos2d/cocos2d-x/pull/19256, but I can’t certain any effects on ANR issues

@SnkTest Have you solved the issue? Im also having this strange ANR’s.

Broadcast of Intent { act=android.intent.action.SCREEN_OFF flg=0x50000010 (has extras) }

“main” tid=1 Waiting

“main” prio=5 tid=1 Waiting

| group=“main” sCount=1 dsCount=0 obj=0x75ea62c8 self=0xb4427800

| sysTid=698 nice=0 cgrp=default sched=0/0 handle=0xb6f53bec

| state=S schedstat=( 0 0 0 ) utm=376 stm=176 core=3 HZ=100

| stack=0xbe723000-0xbe725000 stackSize=8MB

| held mutexes=

at java.lang.Object.wait! (Native method)

  • waiting on <0x338d9aca> (a android.opengl.GLSurfaceView$GLThreadManager)

    at android.opengl.GLSurfaceView$GLThread.onPause (GLSurfaceView.java:1656)

  • locked <0x338d9aca> (a android.opengl.GLSurfaceView$GLThreadManager)

    at android.opengl.GLSurfaceView.onPause (GLSurfaceView.java:559)

    at org.cocos2dx.lib.Cocos2dxGLSurfaceView.onPause (Cocos2dxGLSurfaceView.java:202)

    at org.cocos2dx.lib.Cocos2dxActivity.onPause (Cocos2dxActivity.java:222)

    at android.app.Activity.performPause (Activity.java:6765)

    at android.app.Instrumentation.callActivityOnPause (Instrumentation.java:1338)

    at android.app.ActivityThread.performPauseActivity (ActivityThread.java:4438)

    at android.app.ActivityThread.performPauseActivity (ActivityThread.java:4411)

    at android.app.ActivityThread.handlePauseActivity (ActivityThread.java:4386)

    at android.app.ActivityThread.access$1200 (ActivityThread.java:218)

    at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1755)

    at android.os.Handler.dispatchMessage (Handler.java:102)

    at android.os.Looper.loop (Looper.java:145)

    at android.app.ActivityThread.main (ActivityThread.java:7007)

    at java.lang.reflect.Method.invoke! (Native method)

    at java.lang.reflect.Method.invoke (Method.java:372)

    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1404)

    at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1199)

Cocos2dx 3.17.2

Same issue found in my google console play

any idea ? @slackmoehrle @drelaptop @zhangxm

I don’t have an idea. We can ask @zhangxm and @coulsonwang I know this has been an issue that hasn’t been easy to reproduce for us.

Seem some code add in 3.17.2 cause anr in onPause and older version cause anr in GLSurfaceDestroy. Hope tech team fix it soon. Google play store algo now focus vital. We need keep anr and crash rate low

1 Like

@genix_developer did you able to fix this anr.

I think this PR will fix the issue.