anr 问题处理

自作多情 提交于 2019-12-10 00:18:34

com.xvideostudio.videoeditor  这个应用发生无响应

1. 在system log里面搜索关键字,ANR in,定位到下面的地方

 

11-01 15:52:37.386071  1148  1273 I AnrManager: ANR in com.xvideostudio.videoeditor (com.xvideostudio.videoeditor/.activity.ConfigGifActivity), time=24740223
11-01 15:52:37.386071  1148  1273 I AnrManager: Reason: Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 2.  Wait queue head age: 10273.7ms.)
11-01 15:52:37.386071  1148  1273 I AnrManager: Load: 33.27 / 34.07 / 33.02
11-01 15:52:37.386071  1148  1273 I AnrManager: Android time :[2019-11-01 15:52:37.33] [24758.203]

 

2.在event log里面搜索关键字,定位到如下地方

11-01 15:52:19.400932  1148  1273 I am_anr  : [0,30828,com.xvideostudio.videoeditor,949534276,Input dispatching timed out (Waiting to send non-key event because the touched window has not finished processing certain input events that were delivered to it over 500.0ms ago.  Wait queue length: 2.  Wait queue head age: 10273.7ms.)]

3.导出 data/anr/目录,会记载发生anr时的信息

 

"main" prio=5 tid=1 Waiting
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x72e383b8 self=0x7968dacc00
  | sysTid=30828 nice=-10 cgrp=default sched=0/0 handle=0x796a318ed0
  | state=S schedstat=( 36109524233 2197544342 41857 ) utm=3107 stm=503 core=3 HZ=100
  | stack=0x7fcd875000-0x7fcd877000 stackSize=8192KB
  | held mutexes=
  kernel: __switch_to+0xd4/0xf0
  kernel: futex_wait_queue_me+0xbc/0x108
  kernel: futex_wait+0x11c/0x340
  kernel: do_futex+0x11c/0x18dc
  kernel: SyS_futex+0x120/0x1a4
  kernel: __sys_trace+0x4c/0x4c
  at java.lang.Object.wait(Native method)
  - waiting on <0x0223853f> (a android.opengl.GLSurfaceView$GLThreadManager)
  at java.lang.Object.wait(Object.java:442)
  at java.lang.Object.wait(Object.java:568)
  at android.opengl.GLSurfaceView$GLThread.surfaceDestroyed(GLSurfaceView.java:1713)
  - locked <0x0223853f> (a android.opengl.GLSurfaceView$GLThreadManager)
  at android.opengl.GLSurfaceView.surfaceDestroyed(GLSurfaceView.java:542)
  at android.view.SurfaceView.updateSurface(SurfaceView.java:752)

主线程在等待GLThreadManager对象被唤醒,在anr文件里面搜到GLThread

"GLThread 5127" prio=5 tid=21 Sleeping
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x13004748 self=0x78706b9000
  | sysTid=32739 nice=0 cgrp=default sched=0/0 handle=0x787c153d50
  | state=S schedstat=( 53481643888 4049278319 104249 ) utm=2832 stm=2516 core=5 HZ=100
  | stack=0x787c051000-0x787c053000 stackSize=1039KB
  | held mutexes=
  kernel: __switch_to+0xd4/0xf0
  kernel: futex_wait_queue_me+0xbc/0x108
  kernel: futex_wait+0x11c/0x340
  kernel: do_futex+0x11c/0x18dc
  kernel: SyS_futex+0x120/0x1a4
  kernel: __sys_trace+0x4c/0x4c
  at java.lang.Thread.sleep(Native method)
  - sleeping on <0x007d22a4> (a java.lang.Object)
  at java.lang.Thread.sleep(Thread.java:440)
  - locked <0x007d22a4> (a java.lang.Object)
  at java.lang.Thread.sleep(Thread.java:356)
  at hl.productor.fxlib.a.ap.c(StickerFx.java:607)
  at hl.productor.fxlib.a.ap.a(StickerFx.java:1014)
  at hl.productor.fxlib.d.d(FxEffectBase.java:40)
  at hl.productor.fxlib.h.b(FxNodeBase.java:402)
  at hl.productor.fxlib.ag.a(VideoTrack.java:645)
  at hl.productor.fxlib.i.onDrawFrame(FxRender.java:601)
  at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1581)
  at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1280)

结合上面的信息和代码得知,GLThread线程在等待FxRender的onDrawFrame执行完后才会对GLThreadManager对象进行唤醒。但是onDrawFrame方法一直执行不完,这部分逻辑是三方apk的逻辑,所以此问题为三方问题

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!