Android ANR bugreport log分析

news2025/1/16 7:48:02

最近工作中频繁遇到设备ANR问题,而且是概率性的那种,于是决定花点时间找找规律复现分析下
说道这里,抓日志是问题解决的最有效途径,这里不得不说一下 bugreport log,其实网上关于它的分析方法有很多,在此仅仅是为了记录下bugreport 日志分析的过程和小技巧
希望对大家有所帮助。

1.抓取bugreport 日志(不指定,默认为当前目录)
- adb bugreport ..
- bugreport  anr 目录

2.bugreport log 分析
拿到log,首先要了解下log 抓取到的系统基本信息,主要包括 内存,CPU ,进程队列 ,虚拟内存 , 垃圾回收等信息

2022-04-20 18:15:20.674 870-970/? E/ActivityManager: Aborting stack trace dump (current extra pid=3061); deadline exceeded.
2022-04-20 18:15:20.675 870-970/? I/AnrManager: dumpStackTraces end!
2022-04-20 18:15:20.738 870-970/? I/AnrManager: ANR in 包名 (包名/.ui.activity.MainActivity), time=342068
    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: 6459.2ms.)
    Load: 26.27 / 18.54 / 8.44
    Android time :[2022-04-20 18:15:20.67] [363.181]
    CPU usage from 162797ms to 4885ms ago (2022-04-20 18:12:16.765 to 2022-04-20 18:14:54.677):
      48% 870/system_server: 20% user + 27% kernel / faults: 32190 minor
      17% 312/exe_cq/0: 0% user + 17% kernel
      11% 1691/net.forclass.guard: 2.2% user + 9.2% kernel / faults: 9288 minor
      10% 314/mmcqd/0: 0% user + 10% kernel
      10% 864/WantJoinFireWall: 1.2% user + 9% kernel / faults: 1 minor
      8.8% 635/jbd2/dm-2-8: 0% user + 8.8% kernel
      7.6% 491/surfaceflinger: 4.7% user + 2.9% kernel / faults: 774 minor 2 major
      6% 460/android.hardware.graphics.composer@2.1-service: 2.1% user + 3.9% kernel / faults: 14495 minor
      5.5% 681/netd: 1.6% user + 3.9% kernel / faults: 950 minor 3 major
      3.7% 1107/com.android.settings: 3.1% user + 0.5% kernel / faults: 18086 minor 5224 major
      3.5% 689/android.hardware.sensors@2.0-service-mediatek: 1.5% user + 2% kernel
      2.7% 1030/com.android.systemui: 1.7% user + 1% kernel / faults: 894 minor 22 major
      1.2% 1284/com.google.android.inputmethod.pinyin: 1.1% user + 0.1% kernel / faults: 8048 minor 43 major
      1.3% 204/chre_kthread: 0% user + 1.3% kernel
      1.1% 3061/com.estrongs.android.pop: 0.8% user + 0.3% kernel / faults: 5525 minor 164 major
      0.7% 249/kworker/4:1: 0% user + 0.7% kernel / faults: 67 minor
      0.7% 597/kworker/1:2: 0% user + 0.7% kernel / faults: 25 minor
      0.6% 243/kworker/5:1: 0% user + 0.6% kernel / faults: 61 minor
      0.6% 449/android.hardware.audio@5.0-service-mediatek: 0.3% user + 0.3% kernel / faults: 1040 minor
      0.3% 321/kworker/0:2: 0% user + 0.3% kernel / faults: 34 minor
      0.5% 231/WJFirewallTask: 0% user + 0.5% kernel
      0.5% 102/kworker/2:1: 0% user + 0.5% kernel / faults: 24 minor
      0.5% 240/kworker/0:1: 0% user + 0.5% kernel
      0.5% 7/rcu_preempt: 0% user + 0.5% kernel
      0.4% 323/kworker/6:1H: 0% user + 0.4% kernel
      0.4% 606/kworker/u16:16: 0% user + 0.4% kernel
      0.4% 608/kworker/u16:18: 0% user + 0.4% kernel
      0.4% 333/kworker/7:1H: 0% user + 0.4% kernel
      0.4% 276/ipi_cpu_dvfs_rt: 0% user + 0.4% kernel
      0.4% 332/kworker/5:1H: 0% user + 0.4% kernel
      0.4% 609/kworker/u16:19: 0% user + 0.4% kernel
      0.3% 607/kworker/u16:17: 0% user + 0.3% kernel
      0.3% 322/kworker/4:1H: 0% user + 0.3% kernel
      0.3% 359/logd: 0.1% user + 0.1% kernel / faults: 74 minor 11 major
      0.3% 300/kworker/6:1: 0% user + 0.3% kernel
      0.2% 610/kworker/u16:20: 0% user + 0.2% kernel
      0.1% 604/kworker/u16:14: 0% user + 0.1% kernel
      0.2% 2792/com.ibox.calculators: 0.1% user + 0.1% kernel / faults: 630 minor 1 major
      0.2% 195/pbm: 0% user + 0.2% kernel
      0.2% 46/kworker/7:0: 0% user + 0.2% kernel
      0.1% 41/kworker/6:0: 0% user + 0.1% kernel / faults: 45 minor
      0.2% 477/audioserver: 0.1% user + 0% kernel / faults: 208 minor 2 major
      0.2% 601/kworker/u16:11: 0% user + 0.2% kernel
      0.1% 688/media.codec: 0.1% user + 0% kernel / faults: 6308 minor
      0.1% 470/vendor.mediatek.hardware.mtkpower@1.0-service: 0% user + 0.1% kernel / faults: 1 minor
      0% 582/kworker/7:2: 0% user + 0% kernel / faults: 56 minor
      0.1% 347/ueventd: 0.1% user + 0% kernel / faults: 202 minor 9 major
      0.1% 1145/com.android.phone: 0.1% user + 0% kernel / faults: 702 minor 196 major
      0.1% 2931/com.ckl.fcfilemanager: 0% user + 0% kernel / faults: 698 minor 464 major
      0% 605/kworker/u16:15: 0% user + 0% kernel
      0.1% 1/init: 0% user + 0% kernel / faults: 202 minor 21 major
      0.1% 260/disp_idlemgr: 0% user + 0.1% kernel
      0% 267/present_fence_w: 0% user + 0% kernel
      0% 499/fuelgauged: 0% user + 0% kernel / faults: 1 minor
      0% 1716/com.amap.android.location: 0% user + 0% kernel / faults: 235 minor
      0% 110/ion_mm_heap: 0% user + 0% kernel
      0% 687/wificond: 0% user + 0% kernel / faults: 148 minor
2022-04-20 18:15:20.739 870-970/? I/AnrManager: dumpAnrDebugInfo end: AnrDumpRecord{ 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: 6459.2ms.) ProcessRecord{883191b 3908:包名/u0a97} IsCompleted:true IsCancelled:false }, isAsyncDump = false , isSilentANR = false
2022-04-20 18:15:20.739 870-901/? I/AnrManager: dumpAnrDebugInfoLocked: AnrDumpRecord{ 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: 6459.2ms.) ProcessRecord{883191b 3908:包名/u0a97} IsCompleted:true IsCancelled:false }, isAsyncDump = true, isSilentANR = false
2022-04-20 18:15:20.739 870-901/? I/AnrManager: dumpAnrDebugInfo end: AnrDumpRecord{ 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: 6459.2ms.) ProcessRecord{883191b 3908:包名/u0a97} IsCompleted:true IsCancelled:false }, isAsyncDump = true , isSilentANR = false
2022-04-20 18:15:20.740 870-970/? I/AnrManager: addErrorToDropBox app = ProcessRecord{883191b 3908:包名/u0a97} processName = 包名 activityShortComponentName = 包名/.ui.activity.MainActivity parentShortComponentName = 包名/.ui.activity.MainActivity parentProcess = ProcessRecord{883191b 3908:包名/u0a97} annotation = 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: 6459.2ms.) mTracesFile = /data/anr/anr_2022-04-20-18-15-00-174
2022-04-20 18:15:20.742 870-970/? I/AnrManager:  controller = null
2022-04-20 18:15:20.743 870-970/? I/InputDispatcher: Dropped event because it is stale.
2022-04-20 18:15:20.743 870-885/? W/Looper: Slow dispatch took 2581ms android.fg h=android.os.Handler c=com.android.server.Watchdog$HandlerChecker@bd2bd25 m=0
2022-04-20 18:15:20.757 870-970/? I/chatty: uid=1000(system) InputDispatcher identical 90 lines
2022-04-20 18:15:20.757 870-970/? I/InputDispatcher: Dropped event because it is stale.
2022-04-20 18:15:20.759 870-4081/? I/DropBoxManagerService: add tag=system_app_anr isTagEnabled=true flags=0x2
2022-04-20 18:15:20.784 870-4081/? W/AES: Exception Log handling...
2022-04-20 18:15:20.788 460-460/? I/hwcomposer: [HWC] (0) displayGetActiveConfig config:0  
2022-04-20 18:15:20.801 491-491/? I/BufferQueueProducer: [FramebufferSurface](this:0x76bc693800,id:0,api:1,p:491,c:491) queueBuffer: fps=0.17 dur=5951.50 max=5951.50 min=5951.50
2022-04-20 18:15:20.802 460-460/? I/hwcomposer: [HWCDisplay] [Display_0 (type:1)] fps:0.168050,dur:5950.61,max:5950.61,min:5950.61  
2022-04-20 18:15:20.803 491-973/? I/BufferQueue: [unnamed-491-34](this:0x76b8b3b000,id:34,api:0,p:-1,c:-1) BufferQueue core=(491:/system/bin/surfaceflinger)
2022-04-20 18:15:20.804 491-973/? I/BufferQueueConsumer: [unnamed-491-34](this:0x76b8b3b000,id:34,api:0,p:-1,c:491) connect(C): consumer=(491:/system/bin/surfaceflinger) controlledByApp=false
2022-04-20 18:15:20.804 491-973/? I/BufferQueueConsumer: [unnamed-491-34](this:0x76b8b3b000,id:34,api:0,p:-1,c:491) setConsumerName: unnamed-491-34
2022-04-20 18:15:20.804 491-973/? I/BufferQueueConsumer: [Application Not Responding: 包名#0](this:0x76b8b3b000,id:34,api:0,p:-1,c:491) setConsumerName: Application Not Responding: 包名#0
2022-04-20 18:15:20.804 491-973/? I/BufferQueueConsumer: [Application Not Responding: 包名#0](this:0x76b8b3b000,id:34,api:0,p:-1,c:491) setDefaultBufferSize: width=960 height=391
2022-04-20 18:15:20.807 870-886/? E/GraphicExt: GraphicExtModuleLoader::CreateGraphicExtInstance false
2022-04-20 18:15:20.835 870-4081/? W/AES: skip for Exp level 0
2022-04-20 18:15:20.836 491-973/? I/BufferQueueProducer: [Application Not Responding: 包名#0](this:0x76b8b3b000,id:34,api:1,p:870,c:491) connect(P): api=1 producer=(870:system_server) producerControlledByApp=false
2022-04-20 18:15:20.839 870-983/? E/WifiVendorHal: getWifiLinkLayerStats_1_3_Internal(l.927) failed {.code = ERROR_NOT_SUPPORTED, .description = }
2022-04-20 18:15:20.905 870-886/? W/Looper: Slow dispatch took 110ms android.ui h=android.view.Choreographer$FrameHandler c=android.view.Choreographer$FrameDisplayEventReceiver@67bf45a m=0
2022-04-20 18:15:21.980 870-870/? I/DeviceIdleController: updateChargingLocked: charging=true
2022-04-20 18:15:21.980 870-870/? I/DeviceIdleController: becomeActiveLocked, reason=charging, changeLightIdle=true
2022-04-20 18:15:21.986 460-460/? I/hwcomposer: [HWC] (0) displayGetActiveConfig config:0  
2022-04-20 18:15:22.012 491-973/? I/BufferQueueProducer: [StatusBar#0](this:0x76b8b36800,id:4,api:1,p:1030,c:491) queueBuffer: fps=0.14 dur=7173.60 max=7173.60 min=7173.60
2022-04-20 18:15:22.013 1030-1030/? I/QSTileHost: QSTileHost QSSTATUS =0--VEGASTATUS = 0

日志很清晰了,顺藤摸瓜找到anr具体位置就行,不过这个过程可能会不会太顺利,一步一步来就能找到根源

分析日志小技巧
- anr 搜 "ANR in"
- Reason: Input dispatching timed out
-Load: 
-"mian" / tid= / sysTid=

3.内存占比分析

Total PSS by process:

查看系统是否低内存(MemFree 和 MemAvailable 的值会很小)
adb shell cat proc/meminfo
adb查看应用程序内存使用情况
adb shell dumpsys meminfo <package_name>
了解更多,请参阅以下链接
https://www.jianshu.com/p/6b1c16e23987
https://www.proyy.com/7006950034935660574.html

4.死锁分析

 

 分析结果:tid=26 Blocked 该线程当前阻塞 - waiting to lock <0x0ff86ecf>,发现在等待的锁被  tid=52 Native  线程锁持有...

 5.更多ANR 问题分析
请参阅如下文章:
ANR问题浅析
ANR问题分析的一般套路  
负载Load分析
BugReport 辅助分析利器 ChkBugReport

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/159001.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

小型水库在线监测解决方案

一、方案背景水利部全国水利普查显示我国共有水库98002座&#xff0c;其中小型水库93308座。水库对防汛减灾、供水保障和农业灌溉等至关重要&#xff0c;水库的稳定运行关系到下游人民群众的生命财产安全&#xff0c;关系到当地经济发展和社会稳定。在2020年11月18日国务院常务…

EasyVim:简单强大的VIM配置

EasyVim 简单强大的vim配置&#xff0c;熟练后可大大提高开发效率&#xff08;VS Code的两倍以上&#xff09;。 安装 安装过程需要从github下载很多插件&#xff0c;国内尽量挂VPN git clone https://github.com/yuesong-feng/EasyVim cd EasyVim/ sh ./install.sh vim :P…

JavaScript基础(16)_数组方法、数组遍历、foreach

数组方法unshift():向数组开头添加一个或多个元素&#xff0c;并返回新的数组长度。向前边插入元素以后&#xff0c;其他的元素索引会依次调整。push():向数组的末尾添加一个或多个元素&#xff0c;并返回数组新的长度。该方法会将数组新的长度作为返回值返回。shift():删除数组…

【工具推荐】 Obsidian 插件 Obsidian to Flomo 一键同步内容到 Flomo 插件

目录一、Obsidian、Flomo、Obsidian to Flomo 他们都是什么&#xff1f;1. 什么是 Obsidian &#xff1f;2. 什么是Flomo &#xff1f;3. 什么是Obsidian to Flomo &#xff1f;二、如何安装 Obsidian to Flomo &#xff1f;三、插件使用方法1. 启用插件并配置API四、如何使用插…

《2022大数据产业年度创新技术突破》榜重磅发布丨金猿奖

‍年度金猿榜单/奖项本届“数据猿年度金猿策划活动——2022大数据产业创新技术突破榜单/奖项”由金猿&数据猿共同推出。‍数据智能产业创新服务媒体——聚焦数智 改变商业2022年下半年度&#xff0c;由数据猿、金猿组委会共同推出的第五届 “年度金猿季大型主题策划活动”…

Unity Netcode for GameObjects多人联机(源文件)

一、安装Netcode for Gameobjects Netcode for Gameobjects是Unity新推出的联机解决方案&#xff0c;该解决方案目前处于初期&#xff0c;相关功能不是很完善&#xff0c;但是用起来还不错。下面介绍一下相关用法。 首先下载安装Netcode for Gameobjects&#xff0c;其官方网站…

Elasticsearch入门介绍及Linux安装

前言Elasticsearch是一款分布式高性能的全文搜索引擎&#xff0c;为什么会需要这个呢&#xff0c;像我们平常使用的最多的存储工具就是Mysql&#xff0c;在业界也是非常有名的&#xff0c;我们大部分结构化数据都是用它来存储的&#xff0c;sql语言的操作也是非常方便&#xff…

助力“智慧港口”建设,北部湾港联合美创打造的主数据管理系统上线!

数字化浪潮下&#xff0c;港口企业发展将致力于以数据价值提升和数据价值创造为目标&#xff0c;打造新型“智慧港口”&#xff0c;实现更加经济的港口资源统筹高效利用并降低各类成本&#xff0c;企业通过逐步转变信息资源管理工作模式和利用方式&#xff0c;深度应用新一代信…

在GCP上创建Cloud SQL的三种方式(Console,gcloud,Terraform)

1 简介 Cloud SQL 是GCP上的关系型数据库&#xff0c;常用的有三种方式来创建&#xff1a; (1) 界面操作 (2) 命令行 gcloud (3) Terraform 在开始之前&#xff0c;可以查看&#xff1a;《初始化一个GCP项目并用gcloud访问操作》。 2 GCP 操作界面 登陆GCP&#xff0c;选…

Chevereto V4 首页显示图片托管数量的实现方法

博主最近一直想在Chevereto V4 首页显示图片托管数量&#xff0c;但是网上的方法只针对于Chevereto V3&#xff0c;V4却没有相关教程&#xff0c;查询谷歌也无结果&#xff0c;经博主查询大量案例今天为大家分享一下 Chevereto V4 首页显示图片托管数量的实现方法。1. 修改后台…

70.语义分割和数据集

在 之前讨论的目标检测问题中&#xff0c;我们一直使用方形边界框来标注和预测图像中的目标。 本节将探讨语义分割&#xff08;semantic segmentation&#xff09;问题&#xff0c;它重点关注于如何将图像分割成属于不同语义类别的区域。 与目标检测不同&#xff0c;语义分割可…

20230112编译AIO-3568J的Buildroot(rk356x_linux_release_v1.3.0b_20221213)

20230112编译AIO-3568J的Buildroot&#xff08;rk356x_linux_release_v1.3.0b_20221213&#xff09; 2023/1/12 20:40 当前可以拿到的Buildroot的SDK&#xff1b; rk356x_linux_release_v1.0.0_20210511_split_dir rk356x_linux_release_v1.2.0_20211019_split_dir rk356x_linu…

Ventoy主题美化,以及自行制作方法

Ventoy是基于grub2 所制作的&#xff0c;所以可以自行制作或者将现成的主题套用到Ventoy 方法一&#xff1a; 主题下载地址 上面是两个可以直接使用的Ventoy主题地址&#xff0c;然后下载下来解压文件&#xff0c;我们可以得到 接着往下走&#xff0c;我们可以的得到 现在我们…

Oracle Apex低码平台-定制验证方案

Oracle Apex低码平台-定制验证方案 0 APEX简介&#xff1a; Oracle APEX 是一个低代码开发平台&#xff0c;您可以在该平台上构建可扩展的安全企业应用程序。这些应用程序具有先进的功能&#xff0c;而且可以在任何地方部署。 构建企业应用速度提高 20 倍&#xff0c;代码减…

Dubbo服务降级

Dubbo服务降级 1. 为什么需要服务降级 RPC 是解决分布式系统通信问题的一大利器&#xff0c;而分布式系统的一大特点就是高并发&#xff0c;所以说 RPC 也会面临高并发的场景。在这样的情况下&#xff0c;我们提供服务的每个服务节点就都可能由于访问量过大而引起一系列的问题…

Chrome浏览器插件推荐【第一期】

1、Tampermonkey Tampermonkey&#xff08;油猴&#xff09;是一款免费的浏览器扩展和最为流行的用户脚本管理器&#xff0c;它适用于 Chrome, Microsoft Edge, Safari, Opera Next, 和 Firefox。虽然有些受支持的浏览器拥有原生的用户脚本支持&#xff0c;但 Tampermonkey 将在…

Webpack的应用

处理css文件 总共有src目录下的index.css和index.js、同根的index.html和webpack.config.js文件&#xff0c;然后npm init之后生成package.json文件&#xff0c;npm install后生成package-lock.json文件&#xff0c;最后npm run webpack之后有dist目录下各种文件 index.js i…

nodejs使JWT(全)

Token token表示令牌&#xff0c;用户的登录凭证。 基于 Token 的身份验证方法&#xff0c;使用基于 Token 的身份验证方法&#xff0c;在服务端不需要存储用户的登录记录。大概的流程是这样的&#xff1a; 客户端使用用户名跟密码请求登录服务端收到请求&#xff0c;去验证…

css动画效果之transform

transformTransform属性应用于元素的2D或3D转换。这个属性允许你将元素旋转&#xff0c;缩放&#xff0c;移动&#xff0c;倾斜等。旋转rotate、扭曲skew、移动translate、缩放scale、矩阵变形matrix属性名扩展写法属性含义none定义不进行转换。rotaterotateX()&#xff08;3D写…

rabbitmq+netcore6 【5】Topics:主题

文章目录1&#xff09;前言2&#xff09;Topic exchange 主题交换机3&#xff09;举例4&#xff09;总结5&#xff09;综合以上代码准备工作生产者消费者1消费者2结果验证官网参考链接&#xff1a; https://www.rabbitmq.com/tutorials/tutorial-five-dotnet.html其他人的翻译版…