ANR问题分析
2019-01-07 本文已影响0人
古风子
问题1:今日头条ANR
复习步骤:
主要操作是频繁的从侧边栏拉出今日头条进行分屏操作,多次操作之后,应用发生了ANR,这个会导致手机短暂的在分屏栏中的应用界面黑屏并卡死。不过4-5秒之后又正常。
应用发生ANR的原因是自身主线程被阻塞导致。
"main" prio=5 tid=1 Blocked
| group="main" sCount=1 dsCount=0 obj=0x74f9bbe8 self=0xe7084400
| sysTid=28210 nice=0 cgrp=default sched=0/0 handle=0xe9dcd534
| state=S schedstat=( 1345442830 9928953 492 ) utm=121 stm=13 core=3 HZ=100
| stack=0xff3b6000-0xff3b8000 stackSize=8MB
| held mutexes=
at com.ss.android.common.applog.LogReaper.insertCrashLog(SourceFile:98)
- waiting to lock <0x0d3fbd00> (a com.ss.android.common.applog.LogReaper) held by thread 34
at com.ss.android.common.applog.AppLog.uncaughtException(SourceFile:1408)
at u.aly.n.uncaughtException(SourceFile:34)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1068)
at java.lang.ThreadGroup.uncaughtException(ThreadGroup.java:1063)
关键信息
waiting to lock <0x0d3fbd00> (a com.ss.android.common.applog.LogReaper) held by thread 34
因此,在下面的ANR日志总,查找tid==34
"LogReaper" prio=5 tid=34 TimedWaiting
| group="main" sCount=1 dsCount=0 obj=0x12fcaba0 self=0xcb226e00
| sysTid=28274 nice=0 cgrp=default sched=0/0 handle=0xc9f9b920
| state=S schedstat=( 77341565 2692708 80 ) utm=7 stm=0 core=5 HZ=100
| stack=0xc9e99000-0xc9e9b000 stackSize=1038KB
| held mutexes=
at java.lang.Object.wait!(Native method)
- waiting on <0x00fc7065> (a java.util.concurrent.atomic.AtomicInteger)
at java.lang.Object.wait(Object.java:407)
at com.ss.android.action.b.d.a(SourceFile:216)
at com.ss.android.newmedia.b.onLogSessionBatchEvent(SourceFile:468)
at com.ss.android.common.applog.DBHelper.batchSession(SourceFile:616)
- locked <0x0d4ff1c4> (a com.ss.android.common.applog.DBHelper)
at com.ss.android.common.applog.LogReaper.switchSession(SourceFile:175)
at com.ss.android.common.applog.LogReaper.switchSession(SourceFile:153)
at com.ss.android.common.applog.LogReaper.processItem(SourceFile:122)
- locked <0x0d3fbd00> (a com.ss.android.common.applog.LogReaper)
at com.ss.android.common.applog.LogReaper.run(SourceFile:632)
关键信息:
waiting on <0x00fc7065> (a java.util.concurrent.atomic.AtomicInteger)
应用内代码阻塞引起的