Is there any solution of ANR?

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.

Thanks! Hope it fixed

So recently these ANR surged on play console for my app but after debugging it for some time i found out the the problem was in a deadlock for a process which blocks the main thread and nothing can happen after that.

So, a solution for this could be if you start doing the heavy or suspicious tasks on separate threads so that your main thread doesn’t get blocked and game continues to work. This issue can be device specific for some of the processes as i still get counts of 20-30 daily on a 1 lakh dau, so it is really hard to debug this as you cannot guess which process might be breaking in devices, but definitely it is not related to device ram/os because i have seen it happening in pixel and samsung galaxy series.

Do drop a solution if you find out on this thread.

I encountered the same issue. (cocos2d-x 3.17.2)
But it only surfaced after I integrated Admob SDKBOX sdk.
Before that, even cocos2d-x 3.17.2 worked without this ANR.

Any idea?

@joappdev, I suffered from the same issues (Latest SDKBox issue).
I downgraded SDKBox to v2.4.3.3 and now its ok, ANR level is very low.

@angelvet thanks for reply.
Unfortunately I’m using v2.4.3.3…
I’m trying this fix https://github.com/cocos2d/cocos2d-x/pull/19996 , commented super.onPause().
Hope it works.