jasmine1

AMS和PMS deadlock的watchdog重启

0
阅读(37) 评论(0)

[DESCRIPTION]

SystEMServer发生AMS和PMS DeadLock导致watchdog重启。


[SOLUTION]

问题原因:当前问题是SystemServer发生DeadLock导致watchdog MTK系统重启,是在 KK版本(CL: 2023083
PackageManagerService.java)及L版本上merge进来的这段代码。
at
com.android.server.pm.PackageManagerService.sendResourcesChangedBroADCast(PackageManage
rService.java:11653)
at com.android.server.pm.PackageManagerService.scanPackageLI(PackageManagerService.
java:5089)
对应JBT_TRACE:
"android.fg" prio=5 tid=15 MONITOR
| group="main" sCount=1 dsCount=0 obj=0x41f24be0 self=0x5472bbf0
| sysTid=685 nice=0 sched=0/0 cgrp=apps handle=1416806472
| state=S schedstat=( 241000079 518468774 977 ) utm=15 stm=9 core=0
at
com.android.server.am.ActivityManagerService.monitor(ActivityManagerService.java:~17214
)
- waiting to lock <0x41f33998> (a com.android.server.am.ActivityManagerService) held by
tid=74 (Binder_E)
at com.android.server.Watchdog$HandlerChecker.run(Watchdog.java:217)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:61)
"Binder_E" prio=5 tid=74 MONITOR
| group="main" sCount=1 dsCount=0 obj=0x425baa80 self=0x58cb1e18
| sysTid=2799 nice=0 sched=0/0 cgrp=apps handle=1465564264
| state=S schedstat=( 5981176927 5323168993 13820 ) utm=451 stm=147 core=1
at
com.android.server.pm.PackageManagerService.performDexOpt(PackageManagerService.java:~4
194)
- waiting to lock <0x4201bc08> (a java.lang.Object) held by tid=24 (PackageManager)
at
com.android.server.am.ActivityManagerService.ensurePackageDexOpt(ActivityManagerService
.java:2788)
at
com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerSer
vice.java:5667)
at
com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.
java:5782)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:395)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.
java:2270)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
"PackageManager" prio=5 tid=24 MONITOR
| group="main" sCount=1 dsCount=0 obj=0x4201bb30 self=0x54a4d670
| sysTid=695 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1420083384
| state=S schedstat=( 11407443409 15214773603 15504 ) utm=955 stm=185 core=1
at
com.android.server.am.ActivityManagerService.getRunningUserIds(ActivityManagerService.j
ava:~17750)
- waiting to lock <0x41f33998> (a com.android.server.am.ActivityManagerService) held by
tid=74 (Binder_E)
at
com.android.server.pm.PackageManagerService.sendPackageBroadcast(PackageManagerService.
java:6668)
at
com.android.server.pm.PackageManagerService.sendResourcesChangedBroadcast(PackageManage
rService.java:11655)
at com.android.server.pm.PackageManagerService.scanPackageLI(PackageManagerService.
java:5128)
at
com.android.server.pm.PackageManagerService.installNewPackageLI(PackageManagerService.
java:9057)
at com.android.server.pm.PackageManagerService.installPackageLI(PackageManagerService.
java:9530)
at com.android.server.pm.PackageManagerService.access$2900(PackageManagerService.
java:178)
at com.android.server.pm.PackageManagerService$5.run(PackageManagerService.java:7435)
at android.os.Handler.handleCallback(Handler.java:808)
at android.os.Handler.dispatchMessage(Handler.java:103)
at android.os.Looper.loop(Looper.java:193)
at android.os.HandlerThread.run(HandlerThread.java:61)
这是Google issue,Google在KK及KK以后的版本有在mInstall lock里边增加一段逻辑,导致类似的
问题比JB更容易发生。不过目前看起来这段逻辑也不太好做改动,容易引起更大的side effect。目
前这个问题建议暂时不考虑改动codebase。