美文网首页
ANR例子分析

ANR例子分析

作者: xixi哈哈笑笑 | 来源:发表于2020-10-10 10:41 被阅读0次

1.

TraceBegin:
  at android.bluetooth.BluetoothDevice.getService(BluetoothDevice.java:765)
  - waiting to lock <0x0bd27d7c> (a java.lang.Class<android.bluetooth.BluetoothDevice>) held by thread 20
  at android.bluetooth.BluetoothDevice.<init>(BluetoothDevice.java:808)
  at android.bluetooth.BluetoothDevice$2.createFromParcel(BluetoothDevice.java:851)
  at android.bluetooth.BluetoothDevice$2.createFromParcel(BluetoothDevice.java:849)
  at android.os.Parcel.readParcelable(Parcel.java:2774)
  at android.os.Parcel.readValue(Parcel.java:2668)
  at android.os.Parcel.readArrayMapInternal(Parcel.java:3037)
  at android.os.BaseBundle.initializeFromParcelLocked(BaseBundle.java:288)
  at android.os.BaseBundle.unparcel(BaseBundle.java:232)
  - locked <0x04c36605> (a android.os.Bundle)
  at android.os.BaseBundle.getInt(BaseBundle.java:1030)
  at android.content.Intent.getIntExtra(Intent.java:7404)
  at com.android.systemui.statusbar.phone.PhoneStatusBarPolicy$6.onReceive(PhoneStatusBarPolicy.java:1104)
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0(LoadedApk.java:1391)
  at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(lambda:-1)
  at android.os.Handler.handleCallback(Handler.java:873)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:193)
  at android.app.ActivityThread.main(ActivityThread.java:6739)
  at java.lang.reflect.Method.invoke(Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:911)
TraceEnd:

PhoneStatusBarPolicy类的广播接收调用Intent的getIntExtra方法,getIntExtra方法中又调用Bundle的getInt方法,Bundle继承了BaseBundle,而getInt方法调用initializeFromParcelLocked,initializeFromParcelLocked方法调用Parcel类的readArrayMapSafelyInternal->readValue->readParcelable
readParcelable调用BluetoothDevice的createFromParcel内部方法,最后调到BluetoothDevice的getService方法,getService方法中的同步锁被占用导致超时引起anr

2.

CPU usage from 8806ms to 1574ms ago (2020-06-19 10:31:11.723 to 2020-06-19 10:31:18.955):

66% 202/kswapd0: 0% user + 66% kernel
84% TOTAL: 1.9% user + 31% kernel + 48% iowait + 0.8% irq + 1.1% softirq

2973 06-19 10:29:56.836 0 0 W Kernel-Dmesg: <6>[ 905.391973] lowmemorykiller: Killing '360.vehiclesafe' (11128), adj 800,
2992 06-19 10:30:05.583 0 0 W Kernel-Dmesg: <6>[ 914.136148] lowmemorykiller: Killing 'droid.launcher3' (2813), adj 600,
3203 06-19 10:30:20.428 0 0 W Kernel-Dmesg: <6>[ 928.983072] lowmemorykiller: Killing 'droid.ugc.aweme' (11952), adj 800,
3224 06-19 10:30:24.038 0 0 W Kernel-Dmesg: <6>[ 932.590529] lowmemorykiller: Killing 'eme:pushservice' (11200), adj 800,
3235 06-19 10:30:24.175 0 0 W Kernel-Dmesg: <6>[ 932.731340] lowmemorykiller: Killing 'dex2oat' (12166), adj 800,
3260 06-19 10:30:28.600 0 0 W Kernel-Dmesg: <6>[ 937.153983] lowmemorykiller: Killing '.bydauto:widget' (11621), adj 800,
3273 06-19 10:30:31.749 0 0 W Kernel-Dmesg: <6>[ 940.302453] lowmemorykiller: Killing 'droid.ugc.aweme' (12116), adj 700,
3284 06-19 10:30:33.007 0 0 W Kernel-Dmesg: <6>[ 941.563009] lowmemorykiller: Killing 'd.process.media' (11642), adj 700,
3294 06-19 10:30:33.038 0 0 W Kernel-Dmesg: <6>[ 941.592324] lowmemorykiller: Killing '360.vehiclesafe' (11599), adj 500,
3307 06-19 10:30:34.891 0 0 W Kernel-Dmesg: <6>[ 943.444464] lowmemorykiller: Killing 'com.baidu.input' (3320), adj 200,
3327 06-19 10:31:18.236 0 0 W Kernel-Dmesg: <6>[ 986.792079] lowmemorykiller: Killing 'm.baidu.mapauto' (3437), adj 100,

系统资源紧张 CPU占用率较高,当前系统已经在kill前台应用

相关文章

  • ANR例子分析

    1. PhoneStatusBarPolicy类的广播接收调用Intent的getIntExtra方法,getIn...

  • Android性能-ANR

    ANR基本分析定位方法 ANR分析主要是Input、Broadcast、Service三种ANR, 对应的时间主要...

  • ANR分析

    ANR日志分析 获取日志 trace文件解析 trace文件例子 关注主线程调用栈,断点调试若干次就可搞定了。 基...

  • ANR

    ANR原理分析 什么是ANR ANR(Application Not Responding)就是应用在规定的时间内...

  • ANR问题分析

    本文站在系统角度来简单总结下ANR分析的一般套路。 一、ANR简介 1.1 ANR定义 ANR(Applicati...

  • Android ANR:原理分析及解决办法

    目录:一、ANR说明和原因二、ANR分析办法三、如何降低ANR的概率四、造成ANR的原因及解决办法五、ANR源码分...

  • 奔溃日志收集框架 - anr日志生成与捕获方式分析

    一、ANR日志生成过程 以Input ANR为例来分析下anr日志的生成过程: input触发anr之后会通过I...

  • ANR 分析

    ANR 分析 立个flag

  • linklist超大导致的ANR

    通过ANR的堆栈分析,ANR的堆栈都是停在了linklist的contains()函数。通过源码分析,系统提供的l...

  • Android导出dropbox日志

    大项目中出现anr几乎是必然事件,这里我就不再去赘述怎么分析anr日志了。但是作为分析anr重要依据的必然离不开d...

网友评论

      本文标题:ANR例子分析

      本文链接:https://www.haomeiwen.com/subject/armdpktx.html