Android10 设备死机的问题分析和解决

news2024/12/26 18:33:43

最近客户反馈一个问题,设备偶现死机。最后解决,在此记录。

目录

一死机的现象

二死机的类型

三 死机问题分析

1 死机现象的梳理

2 死机日志

1)日志分析一

2 日志分析二(正确方案)


一死机的现象

设备死机,或者黑屏任何操作无响应,无法点亮屏幕;或亮屏任何操作无响应。只能断电重启。

二死机的类型

  •    逻辑卡顿(block)
  •    死循环 (Deadloop)

  •   死锁 (Deadlock)

这次根据结果先说结论是 死锁导致死机。

三 死机问题分析

1 死机现象的梳理

客户反馈死机问题,暂无提供可复现的逻辑步骤,属于随机发生。这部使用monkey压测,出现死机行为,分析日志,每次都有不同,无法定位原因。

2 死机日志

1)日志分析一

1 开启了ylog开关后复现,都能捕获日志,有些日志就是普通的日志,有日志捕获死机日常。日志结构如下:

2 左侧文件夹traces就是死机log。分析log如下:

0-android.log日志文件中 看到进程全部挂掉,系统死亡。日志如下
M0164CC  11-21 11:50:59.424   366   366 I SPRDHWComposer: HWCDisplay::present_display <785>: No job to commit, return ERR_NO_JOB
M0164CD  11-21 11:50:59.417   249   249 I ServiceManager: service 'netstats' died
M0164CE  11-21 11:50:59.427   480  5944 D BufferPoolAccessor: bufferpool2 0xa7070110 : 0(0 size) total buffers - 0(0 size) used buffers - 7/10 (recycle/alloc) - 3/9 (fetch/transfer)
M0164CF  11-21 11:50:59.427   480  5939 D BufferPoolAccessor: bufferpool2 0xa706fe10 : 0(0 size) total buffers - 0(0 size) used buffers - 8/10 (recycle/alloc) - 2/9 (fetch/transfer)
M0164D0  11-21 11:50:59.427   480  5908 D BufferPoolAccessor: bufferpool2 0xa7070310 : 0(0 size) total buffers - 0(0 size) used buffers - 13/15 (recycle/alloc) - 2/14 (fetch/transfer)
M0164D1  11-21 11:50:59.427   249   249 I ServiceManager: service 'persistent_data_block' died
M0164D2  11-21 11:50:59.428   249   249 I ServiceManager: service 'netpolicy' died
M0164D3  11-21 11:50:59.428   249   249 I ServiceManager: service 'wifi' died
M0164D4  11-21 11:50:59.428   249   249 I ServiceManager: service 'wifiscanner' died
M0164D5  11-21 11:50:59.428   249   249 I ServiceManager: service 'wifip2p' died
M0164D6  11-21 11:50:59.428   249   249 I ServiceManager: service 'notification' died
M0164D7  11-21 11:50:59.428   249   249 I ServiceManager: service 'devicestoragemonitor' died
M0164D8  11-21 11:50:59.428   249   249 I ServiceManager: service 'location' died
M0164D9  11-21 11:50:59.428   249   249 I ServiceManager: service 'country_detector' died
M0164DA  11-21 11:50:59.428   249   249 I ServiceManager: service 'time_detector' died
M0164DB  11-21 11:50:59.428   249   249 I ServiceManager: service 'search' died
M0164DC  11-21 11:50:59.428   249   249 I ServiceManager: service 'wallpaper' died
M0164DD  11-21 11:50:59.428   249   249 I ServiceManager: service 'audio' died
M0164DE  11-21 11:50:59.429   249   249 I ServiceManager: service 'broadcastradio' died
M0164DF  11-21 11:50:59.429   249   249 I ServiceManager: service 'DockObserver' died
M0164E0  11-21 11:50:59.429   249   249 I ServiceManager: service 'midi' died
M0164E1  11-21 11:50:59.429   249   249 I ServiceManager: service 'adb' died
M0164E2  11-21 11:50:59.429   249   249 I ServiceManager: service 'usb' died
M0164E3  11-21 11:50:59.429   249   249 I ServiceManager: service 'serial' died
M0164E4  11-21 11:50:59.429   249   249 I ServiceManager: service 'hardware_properties' died
M0164E5  11-21 11:50:59.429   480   480 D BufferPoolAccessor: bufferpool2 0xa706fd10 : 0(0 size) total buffers - 0(0 size) used buffers - 5/7 (recycle/alloc) - 2/6 (fetch/transfer)
M0164E6  11-21 11:50:59.429   249   249 I ServiceManager: service 'color_display' died
M0164E7  11-21 11:50:59.429  5930  8561 I AudioTrack: pause
M0164E8  11-21 11:50:59.429   480   480 D BufferPoolAccessor: Destruction - bufferpool2 0xa706fd10 cached: 0/0M, 0/0% in use; allocs: 7, 71% recycled; transfers: 6, 67% unfetced
M0164E9  11-21 11:50:59.429   249   249 I ServiceManager: service 'jobscheduler' died
M0164EA  11-21 11:50:59.429   249   249 I ServiceManager: service 'soundtrigger' died
M0164EB  11-21 11:50:59.429   249   249 I ServiceManager: service 'trust' died
M0164EC  11-21 11:50:59.429   249   249 I ServiceManager: service 'backup' died
M0164ED  11-21 11:50:59.429   249   249 I ServiceManager: service 'appwidget' died
M0164EE  11-21 11:50:59.429   249   249 I ServiceManager: service 'role' died
M0164EF  11-21 11:50:59.429   249   249 I ServiceManager: service 'voiceinteraction' died
M0164F0  11-21 11:50:59.429   249   249 I ServiceManager: service 'diskstats' died
M0164F1  11-21 11:50:59.429   249   249 I ServiceManager: service 'runtime' died
M0164F2  11-21 11:50:59.429   480  5944 D BufferPoolAccessor: bufferpool2 0xa7070210 : 0(0 size) total buffers - 0(0 size) used buffers - 11/15 (recycle/alloc) - 4/14 (fetch/transfer)
M0164F3  11-21 11:50:59.429   249   249 I ServiceManager: service 'network_time_update_service' died
M0164F4  11-21 11:50:59.429   480  5944 D BufferPoolAccessor: Destruction - bufferpool2 0xa7070210 cached: 0/0M, 0/0% in use; allocs: 15, 73% recycled; transfers: 14, 71% unfetced
M0164F5  11-21 11:50:59.429   249   249 I ServiceManager: service 'dreams' died
M0164F6  11-21 11:50:59.429   249   249 I ServiceManager: service 'graphicsstats' died
M0164F7  11-21 11:50:59.429   249   249 I ServiceManager: service 'print' died
M0164F8  11-21 11:50:59.429   249   249 I ServiceManager: service 'companiondevice' died
M0164F9  11-21 11:50:59.429   249   249 I ServiceManager: service 'restrictions' died
M0164FA  11-21 11:50:59.429   249   249 I ServiceManager: service 'media_session' died
M0164FB  11-21 11:50:59.429   249   249 I ServiceManager: service 'media_resource_monitor' died
M0164FC  11-21 11:50:59.429   249   249 I ServiceManager: service 'media_router' died
M0164FD  11-21 11:50:59.429   249   249 I ServiceManager: service 'ledsrv' died
M0164FE  11-21 11:50:59.429   249   249 I ServiceManager: service 'shortcut' died
M0164FF  11-21 11:50:59.429   249   249 I ServiceManager: service 'launcherapps' died
M016500  11-21 11:50:59.429   249   249 I ServiceManager: service 'crossprofileapps' died
M016501  11-21 11:50:59.429   249   249 I ServiceManager: service 'media_projection' died
M016502  11-21 11:50:59.430   249   249 I ServiceManager: service 'slice' died
M016503  11-21 11:50:59.430   249   249 I ServiceManager: service 'media.camera.proxy' died
M016504  11-21 11:50:59.430   249   249 I ServiceManager: service 'statscompanion' died
M016505  11-21 11:50:59.430   249   249 I ServiceManager: service 'incidentcompanion' died
M016506  11-21 11:50:59.430   249   249 I ServiceManager: service 'imms' died
M016507  11-21 11:50:59.430   249   249 I ServiceManager: service 'autofill' died
M016508  11-21 11:50:59.430   249   249 I ServiceManager: service 'clipboard' died
M016509  11-21 11:50:59.430   480  5939 D BufferPoolAccessor: bufferpool2 0xa7070010 : 0(0 size) total buffers - 0(0 size) used buffers - 6/11 (recycle/alloc) - 5/10 (fetch/transfer)
M01650A  11-21 11:50:59.430   249   249 I ServiceManager: service 'app_binding' died
M01650B  11-21 11:50:59.430   249   249 I ServiceManager: service 'sprd_power' died
M01650C  11-21 11:50:59.430   480  5939 D BufferPoolAccessor: Destruction - bufferpool2 0xa7070010 cached: 0/0M, 0/0% in use; allocs: 11, 55% recycled; transfers: 10, 50% unfetced
M01650D  11-21 11:50:59.430   249   249 I ServiceManager: service 'sprdssense' died
M01650E  11-21 11:50:59.430   249   249 I ServiceManager: service 'bluetooth_manager' died
M01650F  11-21 11:50:59.430   249   249 I ServiceManager: service 'connmetrics' died
M016510  11-21 11:50:59.430   249   249 I ServiceManager: service 'netd_listener' died
M016511  11-21 11:50:59.430   249   249 I ServiceManager: service 'contexthub' died
M016512  11-21 11:50:59.430   249   249 I ServiceManager: service 'power_ex' died
M016513  11-21 11:50:59.430   249   249 I ServiceManager: service 'otadexopt' died
M016514  11-21 11:50:59.430   249   249 I ServiceManager: service 'user' died
M016515  11-21 11:50:59.430   249   249 I ServiceManager: service 'activity' died
M016516  11-21 11:50:59.430  5927  5927 I Zygote  : Process 6082 exited due to signal 9 (Killed)
M016517  11-21 11:50:59.431  5927  5927 E Zygote  : Exit zygote because system server (pid 6082) has terminated
M016518  11-21 11:50:59.432  5927  5927 D Zygote  : SprdDebug set prop ret = 0
M016519  11-21 11:50:59.432   480  5939 D BufferPoolAccessor: Destruction - bufferpool2 0xa7070110 cached: 0/0M, 0/0% in use; allocs: 10, 70% recycled; transfers: 9, 67% unfetced
M01651A  11-21 11:50:59.433   480  5944 D BufferPoolAccessor: Destruction - bufferpool2 0xa7070310 cached: 0/0M, 0/0% in use; allocs: 15, 87% recycled; transfers: 14, 86% unfetced
M01651B  11-21 11:50:59.433   480   480 D BufferPoolAccessor: Destruction - bufferpool2 0xa706fe10 cached: 0/0M, 0/0% in use; allocs: 10, 80% recycled; transfers: 9, 78% unfetced
M01651C  11-21 11:50:59.435   366   366 D SPRDHWComposer: SprdPrimaryDisplayDevice::commit <784>: No Job to commit, totalLayerCount = 0
M01651D  11-21 11:50:59.435   366   366 I SPRDHWComposer: HWCDisplay::present_display <785>: No job to commit, return ERR_NO_JOB
M01651E  11-21 11:50:59.437  6281  6281 D AndroidRuntime: Shutting down VM
C01651F  11-21 11:50:59.437  6281  6281 E AndroidRuntime: FATAL EXCEPTION: main
C01651F  11-21 11:50:59.437  6281  6281 E AndroidRuntime: Process: com.android.phone, PID: 6281
C01651F  11-21 11:50:59.437  6281  6281 E AndroidRuntime: DeadSystemException: The system died; earlier logs will point to the root cause
M016520  11-21 11:50:59.439   249   249 I ServiceManager: service 'procstats' died
M016521  11-21 11:50:59.439   249   249 I ServiceManager: service 'meminfo' died
M016522  11-21 11:50:59.439   249   249 I ServiceManager: service 'gfxinfo' died
M016523  11-21 11:50:59.439   249   249 I ServiceManager: service 'dbinfo' died
M016524  11-21 11:50:59.439   249   249 I ServiceManager: service 'cpuinfo' died
M016525  11-21 11:50:59.439   249   249 I ServiceManager: service 'permission' died
M016526  11-21 11:50:59.439   249   249 I ServiceManager: service 'processinfo' died
M016527  11-21 11:50:59.439   249   249 I ServiceManager: service 'overlay' died
M016528  11-21 11:50:59.439   249   249 I ServiceManager: service 'sensor_privacy' died
M016529  11-21 11:50:59.439   249   249 I ServiceManager: service 'sensorservice' died
M01652A  11-21 11:50:59.439  5931  6023 E IPCThreadState: attemptIncStrongHandle(4): Not supported
M01652B  11-21 11:50:59.439   249   249 I ServiceManager: service 'ethernet' died
M01652C  11-21 11:50:59.439   249   249 I ServiceManager: service 'battery' died
M01652D  11-21 11:50:59.439   249   249 I ServiceManager: service 'batteryproperties' died
M01652E  11-21 11:50:59.439   249   249 I ServiceManager: service 'device_identifiers' died
M01652F  11-21 11:50:59.439   249   249 I ServiceManager: service 'uri_grants' died
M016530  11-21 11:50:59.440  6281  6281 D HprofFactory: Create HprofDebugEx
M016531  11-21 11:50:59.439   249   249 I ServiceManager: service 'activity_task' died
M016532  11-21 11:50:59.444   249   249 I ServiceManager: service 'appops' died
M016533  11-21 11:50:59.444   249   249 I ServiceManager: service 'batterystats' died
M016534  11-21 11:50:59.444   249   249 I ServiceManager: service 'power' died
M016535  11-21 11:50:59.444   249   249 I ServiceManager: service 'thermalservice' died
M016536  11-21 11:50:59.444   249   249 I ServiceManager: service 'recovery' died
M016537  11-21 11:50:59.444   249   249 I ServiceManager: service 'display' died
M016538  11-21 11:50:59.444   249   249 I ServiceManager: service 'package' died
M016539  11-21 11:50:59.444   249   249 I ServiceManager: service 'package_native' died
M01653A  11-21 11:50:59.444   249   249 I ServiceManager: service 'usagestats' died
M01653B  11-21 11:50:59.444   249   249 I ServiceManager: service 'webviewupdate' died
M01653C  11-21 11:50:59.444   249   249 I ServiceManager: service 'binder_calls_stats' died
M01653D  11-21 11:50:59.444   249   249 I ServiceManager: service 'looper_stats' died
M01653E  11-21 11:50:59.444  6281  6281 I Process : Sending signal. PID: 6281 SIG: 9
。。。。。(略)

3 看以上日志,系统服务全部挂掉,接下来我们继续分析log

看android0.log日志,我们分析如下。

发生SWT:
  "android.fg"线程在等锁<0x0b167f2f>,该锁是被"android.display"持有;
  "android.display"又在等锁<0x046172a2>,该锁是被"main"线程持有;
  "main"线程又在等锁<0x0d005081>,该锁是被"HwBinder:745_5"持有;
  "HwBinder:745_5"线程又在等锁<0x0b167f2f>,导致发生死锁了。

[下一步计划]
待AMS看下死锁原因,谢谢!

[分析过程]  
[1119anrlog\ap\000-1119_153646_poweron\0-android.log]:
E00CBFE  11-19 15:42:02.313   745   770 I watchdog: Blocked in handler on foreground thread (android.fg), Blocked in handler on main thread (main), Blocked in handler on ui thread (android.ui), Blocked in handler on display thread (android.display), Blocked in handler on ActivityManager (ActivityManager), Blocked in handler on PowerManagerService (PowerManagerService)
S00CCF3  11-19 15:42:15.914   745   770 W Watchdog: *** WATCHDOG KILLING SYSTEM PROCESS: Blocked in handler on foreground thread (android.fg), Blocked in handler on main thread (main), Blocked in handler on ui thread (android.ui), Blocked in handler on display thread (android.display), Blocked in handler on ActivityManager (ActivityManager), Blocked in handler on PowerManagerService (PowerManagerService)
 
----- pid 745 at 2024-11-19 15:41:21 -----
Cmd line: system_server

"android.fg" prio=5 tid=14 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x13141228 self=0x9a7fda00
  | sysTid=764 nice=0 cgrp=default sched=0/0 handle=0x8454c230
  | state=S schedstat=( 1707629333 1820559435 5437 ) utm=148 stm=22 core=1 HZ=100
  | stack=0x84449000-0x8444b000 stackSize=1040KB
  | held mutexes=
  at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:15827)
  - waiting to lock <0x0b167f2f> (a com.android.server.am.ActivityManagerServiceEx) held by thread 17
  at android.app.ContextImpl.sendOrderedBroadcastAsUser(ContextImpl.java:1314)
  at android.app.ContextImpl.sendOrderedBroadcastAsUser(ContextImpl.java:1276)
  at com.android.server.ConnectivityService.sendDataActivityBroadcast(ConnectivityService.java:2086)
  at com.android.server.ConnectivityService.access$400(ConnectivityService.java:235)
  at com.android.server.ConnectivityService$3.interfaceClassDataActivityChanged(ConnectivityService.java:1664)
  at com.android.server.NetworkManagementService.lambda$notifyInterfaceClassActivity$5(NetworkManagementService.java:438)
  at com.android.server.-$$Lambda$NetworkManagementService$D43p3Tqq7B3qaMs9AGb_3j0KZd0.sendCallback(lambda:-1)
  at com.android.server.NetworkManagementService.invokeForAllObservers(NetworkManagementService.java:340)
  at com.android.server.NetworkManagementService.notifyInterfaceClassActivity(NetworkManagementService.java:438)
  at com.android.server.NetworkManagementService.access$1200(NetworkManagementService.java:117)
  at com.android.server.NetworkManagementService$NetdUnsolicitedEventListener.lambda$onInterfaceClassActivityChanged$0$NetworkManagementService$NetdUnsolicitedEventListener(NetworkManagementService.java:666)
  at com.android.server.-$$Lambda$NetworkManagementService$NetdUnsolicitedEventListener$0xWa9DGxTnoGVHppsM-nng2PygE.run(lambda:-1)
  at android.os.Handler.handleCallback(Handler.java:883)
  at android.os.Handler.dispatchMessage(Handler.java:100)
  at android.os.Looper.loop(Looper.java:214)
  at android.os.HandlerThread.run(HandlerThread.java:67)
  at com.android.server.ServiceThread.run(ServiceThread.java:44)
 
"android.display" prio=5 tid=17 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x13141568 self=0x9a800400
  | sysTid=767 nice=-3 cgrp=default sched=0/0 handle=0x84231230
  | state=S schedstat=( 875860938 1723520664 3899 ) utm=62 stm=25 core=2 HZ=100
  | stack=0x8412e000-0x84130000 stackSize=1040KB
  | held mutexes=
  at com.android.server.power.PowerManagerService.updateUidProcStateInternal(PowerManagerService.java:3148)
  - waiting to lock <0x046172a2> (a java.lang.Object) held by thread 1
  at com.android.server.power.PowerManagerService$LocalService.updateUidProcState(PowerManagerService.java:5200)
  at com.android.server.am.ActivityManagerService.enqueueUidChangeLocked(ActivityManagerService.java:16904)
  at com.android.server.am.OomAdjuster.updateOomAdjLocked(OomAdjuster.java:621)
  at com.android.server.am.ActivityManagerService.updateOomAdjLocked(ActivityManagerService.java:17226)
  at com.android.server.am.ActivityManagerService$LocalService.updateOomAdj(ActivityManagerService.java:18350)
  - locked <0x0b167f2f> (a com.android.server.am.ActivityManagerServiceEx)
  at com.android.server.wm.-$$Lambda$yIIsPVyXvnU3Rv8mcliit-gIpSs.run(lambda:-1)
  at android.os.Handler.handleCallback(Handler.java:883)
  at android.os.Handler.dispatchMessage(Handler.java:100)
  at android.os.Looper.loop(Looper.java:214)
  at android.os.HandlerThread.run(HandlerThread.java:67)
  at com.android.server.ServiceThread.run(ServiceThread.java:44)
 
"main" prio=5 tid=1 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x757ab450 self=0xb053de00
  | sysTid=745 nice=-2 cgrp=default sched=0/0 handle=0xb0b20dc0
  | state=S schedstat=( 6436213292 2293829926 7935 ) utm=480 stm=163 core=1 HZ=100
  | stack=0xbe5e9000-0xbe5eb000 stackSize=8192KB
  | held mutexes=
  at com.android.server.BatteryService$LocalService.getBatteryChargeCounter(BatteryService.java:1337)
  - waiting to lock <0x0d005081> (a java.lang.Object) held by thread 130
  at com.android.server.power.batterysaver.BatterySavingStats.injectBatteryLevel(BatterySavingStats.java:248)
  at com.android.server.power.batterysaver.BatterySavingStats.transitionStateLocked(BatterySavingStats.java:287)
  at com.android.server.power.batterysaver.BatterySavingStats.transitionState(BatterySavingStats.java:268)
  - locked <0x046172a2> (a java.lang.Object)
  at com.android.server.power.batterysaver.BatterySaverController.updateBatterySavingStats(BatterySaverController.java:519)
  - locked <0x046172a2> (a java.lang.Object)
  at com.android.server.power.batterysaver.BatterySaverController.access$100(BatterySaverController.java:59)
  at com.android.server.power.batterysaver.BatterySaverController$1.onReceive(BatterySaverController.java:187)
  at android.app.LoadedApk$ReceiverDispatcher$Args.lambda$getRunnable$0$LoadedApk$ReceiverDispatcher$Args(LoadedApk.java:1583)
  at android.app.-$$Lambda$LoadedApk$ReceiverDispatcher$Args$_BumDX2UKsnxLVrE6UJsJZkotuA.run(lambda:-1)
  at android.os.Handler.handleCallback(Handler.java:883)
  at android.os.Handler.dispatchMessage(Handler.java:100)
  at android.os.Looper.loop(Looper.java:214)
  at com.android.server.SystemServer.run(SystemServer.java:562)
  at com.android.server.SystemServer.main(SystemServer.java:370)
  at java.lang.reflect.Method.invoke(Native method)
  at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:914)
 
"HwBinder:745_5" prio=5 tid=130 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x147408b0 self=0x7de38e00
  | sysTid=2169 nice=0 cgrp=default sched=0/0 handle=0x7ba8c230
  | state=S schedstat=( 35393468 114781610 106 ) utm=3 stm=0 core=2 HZ=100
  | stack=0x7b991000-0x7b993000 stackSize=1008KB
  | held mutexes=
  at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:15827)
  - waiting to lock <0x0b167f2f> (a com.android.server.am.ActivityManagerServiceEx) held by thread 17
  at android.app.ContextImpl.sendBroadcast(ContextImpl.java:1049)
  at com.android.server.BatteryService$Led.sendLightActionBroadcast(BatteryService.java:1128)
  at com.android.server.BatteryService$Led.updateLightsLocked(BatteryService.java:1179)
  at com.android.server.BatteryService.processValuesLocked(BatteryService.java:680)
  at com.android.server.BatteryService.update(BatteryService.java:453)
  - locked <0x0d005081> (a java.lang.Object)
  at com.android.server.BatteryService.access$1100(BatteryService.java:116)
  at com.android.server.BatteryService$HealthHalCallback.healthInfoChanged(BatteryService.java:1187)
  at android.hardware.health.V2_0.IHealthInfoCallback$Stub.onTransact(IHealthInfoCallback.java:440)
 
"android.ui" prio=5 tid=15 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x13141398 self=0x9a7fe800
  | sysTid=765 nice=-2 cgrp=default sched=0/0 handle=0x84443230
  | state=S schedstat=( 2231931697 1799238491 11891 ) utm=148 stm=74 core=0 HZ=100
  | stack=0x84340000-0x84342000 stackSize=1040KB
  | held mutexes=
  at com.android.server.am.ActivityManagerService.dispatchUidsChanged(ActivityManagerService.java:3345)
  - waiting to lock <0x0b167f2f> (a com.android.server.am.ActivityManagerServiceEx) held by thread 17
 
"ActivityManager" prio=5 tid=23 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x13141c58 self=0x9a83d800
  | sysTid=773 nice=-2 cgrp=default sched=0/0 handle=0x83bfb230
  | state=S schedstat=( 769154699 733906338 2390 ) utm=56 stm=20 core=1 HZ=100
  | stack=0x83af8000-0x83afa000 stackSize=1040KB
  | held mutexes=
  at com.android.server.am.ActivityManagerService.idleUids(ActivityManagerService.java:17290)
  - waiting to lock <0x0b167f2f> (a com.android.server.am.ActivityManagerServiceEx) held by thread 17
 
"PowerManagerService" prio=5 tid=33 Blocked
  | group="main" sCount=1 dsCount=0 flags=1 obj=0x13145a78 self=0x9a846400
  | sysTid=783 nice=-4 cgrp=default sched=0/0 handle=0x830ab230
  | state=S schedstat=( 369337669 465048778 2947 ) utm=20 stm=16 core=2 HZ=100
  | stack=0x82fa8000-0x82faa000 stackSize=1040KB
  | held mutexes=
  at com.android.server.power.PowerManagerService$BatteryReceiver.onReceive(PowerManagerService.java:4070)
  - waiting to lock <0x046172a2> (a java.lang.Object) held by thread 1 

4 以上日志结论是发生死锁导致死机。我们继续分析

文件夹中有crash.log.看日志如下

C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: FATAL EXCEPTION: main
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: Process: com.android.calendar, PID: 17985
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.calendar/com.android.calendar.AllInOneActivity}: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.android.calendar.DayFragment: could not find Fragment constructor
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3322)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3475)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:83)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2039)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.os.Handler.dispatchMessage(Handler.java:107)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.os.Looper.loop(Looper.java:214)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.ActivityThread.main(ActivityThread.java:7626)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at java.lang.reflect.Method.invoke(Native Method)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:503)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: Caused by: android.app.Fragment$InstantiationException: Unable to instantiate fragment com.android.calendar.DayFragment: could not find Fragment constructor
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.Fragment.instantiate(Fragment.java:562)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.FragmentContainer.instantiate(FragmentContainer.java:53)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.FragmentState.instantiate(FragmentState.java:77)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.FragmentManagerImpl.restoreAllState(FragmentManager.java:2900)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.FragmentController.restoreAllState(FragmentController.java:142)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.Activity.onCreate(Activity.java:1504)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at com.android.calendar.AllInOneActivity.onCreate(AllInOneActivity.java:274)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:7879)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.Activity.performCreate(Activity.java:7867)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1306)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3294)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	... 11 more
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: Caused by: java.lang.NoSuchMethodException: com.android.calendar.DayFragment.<init> []
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at java.lang.Class.getConstructor0(Class.java:2332)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at java.lang.Class.getConstructor(Class.java:1728)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	at android.app.Fragment.instantiate(Fragment.java:543)
C046623  11-20 11:14:51.848 17985 17985 E AndroidRuntime: 	... 21 more

刚开始一直以为是这两个造成的,但是此处未做过定制,所以问题不是这里。继续寻找问题(后续发现我被这个crash误导了,这是monkey压测捕获的log,正式的log日志是这里的日志内容不一样的)

2 日志分析二(正确方案)

因为无复现逻辑还是想法触发死机的行为,无意间使用数据线插拔设备,导致设备卡顿,赶紧导出日志

  1. 日志结构如下:

    看以上日志结构,最外层的文件夹结尾都是fwkreboot,说明fw是重启的。日志都有traces文件夹,里面都有anr的log日志,说明发生了卡顿,现象也是如此。
  2. 查看0-android_crash.log 日志如下(其他crash日志也是同样的内容)

    看日志说明,系统发生死机,fwkreboot是重启行为。可以看时间点以前的log确定问题点
  3. 接下来继续看traces下的anr 日志。寻找相同的日志log,截图如下
  4. 可以看到以上截图,有sendLightActionBroadcast方法 发生blocked,在BatteryService类里。接下来我们去阅读BatteryService修改的逻辑。
  5. BatteryService中开发逻辑

  6. 看代码,我们在指示灯亮起时发送广播。说明发送广播时发生了卡顿。看该类中有发送广播的逻辑如下截图

    截图中所有发送的广播都是放在队列里面发送。这样我们的广播方式和他们保持一致就可有了。
  7. 修改方案:将广播放在Handler里面发送。
  8. 打包测试验证。未复现卡顿或死机现象。问题解决
     

总结:第一次遇到死机现象还是有点蒙逼的,因为没有复现逻辑,不确定造成死机的原因,前期clash的日志误导了判断。后续可复现时日志重复,根据前期日志的分析,定位就非常容易了。写次日志更多的是梳理从问题到日志分析,到问题定位解决,从宏观到具体的一个思路和日志结构的直观浏览。

OVER~

参考文章

Android的死机、重启问题分析方法

Android各种卡死黑屏系统稳定性问题Log抓取大荟萃

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

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

相关文章

koa中间件

文章目录 1. koa中间件简介2. 中间件类型1. 应用级中间件2. 路由级中间件3. 错误处理中间件4. 第三方中间件 3.中间件执行流程 1. koa中间件简介 在Koa中&#xff0c;中间件呈现为一个异步函数&#xff0c;该函数支持 async/await 语法&#xff0c;它接收两个参数&#xff1a;…

python学opencv|读取视频(一)灰度视频制作和保存

【1】引言 上一次课学习了用opencv读取图像&#xff0c;掌握了三个函数&#xff1a;cv.imread()、cv.imshow()、cv.imwrite() 相关链接如下&#xff1a; python学opencv|读取图像-CSDN博客 这次课我们继续&#xff0c;来学习用opencv读取视频。 【2】学习资源 首先是官网…

BioDeepAV:一个多模态基准数据集,包含超过1600个深度伪造视频,用于评估深度伪造检测器在面对未知生成器时的性能。

2024-11-29, 由罗马尼亚布加勒斯特大学创建BioDeepAV数据集&#xff0c;它专门设计来评估最先进的深度伪造检测器在面对未见过的深度伪造生成器时的泛化能力&#xff0c;这对于提高检测器的鲁棒性和适应性具有重要意义。 数据集地址&#xff1a;biodeep 一、研究背景&#xff1…

Apache Airflow 快速入门教程

Apache Airflow已经成为Python生态系统中管道编排的事实上的库。与类似的解决方案相反&#xff0c;由于它的简单性和可扩展性&#xff0c;它已经获得了普及。在本文中&#xff0c;我将尝试概述它的主要概念&#xff0c;并让您清楚地了解何时以及如何使用它。 Airflow应用场景 …

【OpenAI库】从0到1深入理解Python调用OpenAI库的完整教程:从入门到实际运用

文章目录 Moss前沿AI一、初识OpenAI API1.1 获取API-Key&#xff08;两种方案&#xff09;1.2 安装OpenAI库 二、Python调用OpenAI API的基础设置2.1 设置API密钥和Base URL2.2 参数详解 三、构建一个简单的聊天应用3.1 创建聊天请求3.2 参数详解3.3 处理响应 四、完整代码示例…

42 基于单片机的智能浇花系统

目录 一、主要功能 二、硬件资源 三、程序编程 四、实现现象 一、主要功能 基于51单片机&#xff0c;采样DHT11温湿度传感器检测温湿度&#xff0c;通过LCD1602显示 4*4按键矩阵可以设置温度湿度阈值&#xff0c;温度大于阈值则开启水泵&#xff0c;湿度大于阈值则开启风扇…

typecho 添加主题备份及恢复功能

typecho 换主题很简单&#xff0c;但是确有一个比较麻烦的事情&#xff0c;就是主题配置在切换主题的同时也就被删除了。于是&#xff0c;今天我下决心要弄一个备份恢复的功能出来。网上查了很久&#xff0c;都没有找到适合的&#xff08;不过还是有参考价值的&#xff09;。最…

docker部署RustDesk自建服务器

客户端&#xff1a; Releases rustdesk/rustdesk GitHub 服务端&#xff1a; 项目官方地址&#xff1a;GitHub - rustdesk/rustdesk-server: RustDesk Server Program 1、拉取RustDesk库 docker pull rustdesk/rustdesk-server:latest 阿里云库&#xff1a; docker pu…

从零开始了解推荐系统(算法构建、召回、粗排、精排、重排、冷启动、衡量标准)

算法构建 推荐算法流程 实际上是一种信息处理逻辑&#xff0c;当获取了用户与内容的信息之后&#xff0c;按照一定的逻辑处理信息后&#xff0c;产生推荐结果。热度排行榜就是最简单的一种推荐方法&#xff0c;依赖的逻辑是当一个内容被大多数用户喜欢&#xff0c;那么大概率…

【第 1 章 初识 C 语言】1.8 使用 C 语言的 7 个步骤

目录 1.8 使用 C 语言的 7 个步骤 1.8.1 第 1 步&#xff1a;定义程序的目标 1.8.2 第 2 步&#xff1a;设计程序 1.8.3 第 3 步&#xff1a;编写代码 1.8.4 第 4 步&#xff1a;编译 1.8.5 第 5 步&#xff1a;运行程序 1.8.6 第 6 步&#xff1a;测试和调试程序 1.8.…

基于Matlab卡尔曼滤波的GPS/INS集成导航系统研究与实现

随着智能交通和无人驾驶技术的迅猛发展&#xff0c;精确可靠的导航系统已成为提升车辆定位精度与安全性的重要技术。全球定位系统&#xff08;GPS&#xff09;和惯性导航系统&#xff08;INS&#xff09;在导航应用中各具优势&#xff1a;GPS提供全球定位信息&#xff0c;而INS…

C++知识整理day3类与对象(下)——赋值运算符重载、取地址重载、列表初始化、友元、匿名对象、static

文章目录 1.赋值运算符重载1.1 运算符重载1.2 赋值运算符重载 2.取地址重载2.1 const成员函数2.2 取地址运算符重载 3.类与对象的补充3.1 再探构造函数---初始化列表3.2 类型转换3.3 static成员3.4 友元3.5 内部类3.6 匿名对象3.7 对象拷贝时的编译器优化 1.赋值运算符重载 赋…

深入解析级联操作与SQL完整性约束异常的解决方法

目录 前言1. 外键约束与级联操作概述1.1 什么是外键约束1.2 级联操作的实际应用场景 2. 错误分析&#xff1a;SQLIntegrityConstraintViolationException2.1 错误场景描述2.2 触发错误的根本原因 3. 解决方法及优化建议3.1 数据库级别的解决方案3.2 应用层的解决方案 4. 友好提…

dns实验3:主从同步-完全区域传输

服务器192.168.234.111&#xff08;主服务器&#xff09;&#xff0c;打开配置文件&#xff1a; 打开配置文件&#xff1a; 关闭防火墙&#xff0c;改宽松模式&#xff1a; 重启服务&#xff1a; 服务器192.168.234.112&#xff08;从服务器&#xff09;&#xff0c;打开配置文…

LeetCode刷题 -- 分治快排

目录 颜色分类题目解析算法原理代码 排序数组题目解析算法原理代码 数组中第K个最大元素题目解析算法原理代码 LCR 159. 库存管理 III题目解析算法原理代码 颜色分类 题目链接 题目解析 数组分为三块 算法原理 1.如果nums[i] 0&#xff0c;left, i下标对应元素交换&#xff0c…

【论文笔记】Leveraging the Power of MLLMs for Gloss-Free Sign Language Translation

&#x1f34e;个人主页&#xff1a;小嗷犬的个人主页 &#x1f34a;个人网站&#xff1a;小嗷犬的技术小站 &#x1f96d;个人信条&#xff1a;为天地立心&#xff0c;为生民立命&#xff0c;为往圣继绝学&#xff0c;为万世开太平。 基本信息 标题: Leveraging the Power of …

TsingtaoAI具身智能高校实训方案通过华为昇腾技术认证

日前&#xff0c;TsingtaoAI推出的“具身智能高校实训解决方案-从AI大模型机器人到通用具身智能”基于华为技术有限公司AI框架昇思MindSpore&#xff0c;完成并通过昇腾相互兼容性技术认证。 TsingtaoAI&华为昇腾联合解决方案 本项目“具身智能高校实训解决方案”以实现高…

如何抓取亚马逊页面动态加载的内容:Python爬虫实践指南

引言 在现代电商领域&#xff0c;数据的重要性不言而喻。亚马逊作为全球领先的电商平台&#xff0c;其页面上动态加载的内容包含了丰富的商品信息。然而&#xff0c;传统的爬虫技术往往难以应对JavaScript动态加载的内容。本文将详细介绍如何使用Python结合Selenium工具来抓取…

tcpdump抓包wireshark分析

背景 分析特定协议的数据包&#xff0c;如 HTTP、DNS、TCP、UDP 等&#xff0c;诊断网络问题&#xff0c;例如连接故障、延迟和数据包丢失。 大概过程 1.安装tcpdump yum update yum install tcpdump2.抓包&#xff0c;从当前时间起&#xff0c;一小时后停止&#xff0c…

如何进行Appium实现移动端UI自动化测试呢?

&#x1f345; 点击文末小卡片 &#xff0c;免费获取软件测试全套资料&#xff0c;资料在手&#xff0c;涨薪更快 Appium是一个开源跨平台移动应用自动化测试框架。 既然只是想学习下Appium如何入门&#xff0c;那么我们就直奔主题。文章结构如下&#xff1a; 为什么要使用…