WATCHDOG NOT KILLING SYSTEM PROCESS com.android.server.am.ActivityManagerService Dead Lock

1,117 views
Skip to first unread message

Maunik Shah

unread,
Dec 12, 2012, 7:09:54 AM12/12/12
to android-...@googlegroups.com
Hi All,

I'm facing issue of deadlock in system_server Process.

Trace file logs,

11-22 16:51:57.010 503 644 W Watchdog: *** WATCHDOG NOT KILLING SYSTEM PROCESS:

----- pid 503 at 2012-11-22 16:51:54 -----
Cmd line: system_server

"android.server.ServerThread" prio=5 tid=12 MONITOR

group="main" sCount=1 dsCount=0 obj=0x414c8c10 self=0x491c8928
sysTid=517 nice=-2 sched=0/0 cgrp=apps handle=1361196144
schedstat=( 0 0 0 ) utm=20514 stm=5949 core=0
at com.android.server.am.ActivityManagerService.monitor(ActivityManagerService.java:~15219)
  • waiting to lock <0x414d2cf0> (a com.android.server.am.ActivityManagerService) held by tid=28 (InputDispatcher)
    at com.android.server.Watchdog$HeartbeatHandler.handleMessage(Watchdog.java:134)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:137)
    at com.android.server.ServerThread.run(SystemServer.java:907)

"InputDispatcher" prio=10 tid=28 MONITOR

group="main" sCount=1 dsCount=0 obj=0x417c5e70 self=0x50dd6008
sysTid=539 nice=-8 sched=0/0 cgrp=apps handle=1306828184
schedstat=( 0 0 0 ) utm=15529 stm=13434 core=0
at com.android.server.wm.WindowManagerService.prepareAppTransition(WindowManagerService.java:~3897)
  • waiting to lock <0x41670338> (a java.util.HashMap) held by tid=77 (Binder_C)
    at com.android.server.am.ActivityStack.updateTransitLocked(ActivityStack.java:4133)
    at com.android.server.am.ActivityStack.moveTaskToFrontLocked(ActivityStack.java:4193)
    at com.android.server.am.ActivityStack.startActivityUncheckedLocked(ActivityStack.java:2704)
    at com.android.server.am.ActivityStack.startActivityLocked(ActivityStack.java:2566)
    at com.android.server.am.ActivityStack.startActivityMayWait(ActivityStack.java:3114)
    at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:2374)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1411)
    at android.app.ContextImpl.startActivity(ContextImpl.java:899)
    at android.app.ContextImpl.startActivity(ContextImpl.java:888)
    at com.android.internal.policy.impl.PhoneWindowManager.interceptKeyBeforeDispatching(PhoneWindowManager.java:2011)
    at com.android.server.wm.InputMonitor.interceptKeyBeforeDispatching(InputMonitor.java:310)
    at com.android.server.input.InputManagerService.interceptKeyBeforeDispatching(InputManagerService.java:1259)
    at dalvik.system.NativeStart.run(Native Method)

"Binder_C" prio=5 tid=77 MONITOR

group="main" sCount=1 dsCount=0 obj=0x41ad6f70 self=0x513ac038
sysTid=15352 nice=0 sched=0/0 cgrp=apps handle=1360639152
schedstat=( 0 0 0 ) utm=9164 stm=4626 core=0
at com.android.server.am.ActivityStack.startActivityMayWait(ActivityStack.java:~3026)
  • waiting to lock <0x414d2cf0> (a com.android.server.am.ActivityManagerService) held by tid=28 (InputDispatcher)
    at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:2374)
    at android.app.Instrumentation.execStartActivity(Instrumentation.java:1411)
    at android.app.ContextImpl.startActivity(ContextImpl.java:899)
    at android.app.ContextImpl.startActivity(ContextImpl.java:888)
    at com.android.internal.policy.impl.PhoneWindowManager.interceptKeyBeforeDispatching(PhoneWindowManager.java:2011)
    at com.android.server.wm.InputMonitor.interceptKeyBeforeDispatching(InputMonitor.java:310)
    at com.android.server.input.InputManagerService.interceptKeyBeforeDispatching(InputManagerService.java:1259)
    at com.android.server.input.InputManagerService.nativeUnregisterInputChannel(Native Method)
    at com.android.server.input.InputManagerService.unregisterInputChannel(InputManagerService.java:414)
    at com.android.server.wm.WindowState.disposeInputChannel(WindowState.java:841)
    at com.android.server.wm.WindowManagerService.removeWindowLocked(WindowManagerService.java:2395)
    at com.android.server.wm.WindowManagerService.removeWindow(WindowManagerService.java:2381)
    at com.android.server.wm.Session.remove(Session.java:149)
    at android.view.IWindowSession$Stub.onTransact(IWindowSession.java:124)
    at com.android.server.wm.Session.onTransact(Session.java:111)
    at android.os.Binder.execTransact(Binder.java:367)
    at dalvik.system.NativeStart.run(Native Method)

Here, the deadlock happened between "mWindowMap" and "mService" objects. 

As far as my knowledge, to solve this issue,

either 1) We need to change the sequence of the both the locks, 
or 2) We need to remove one of those lock. 

Could you please help me out on this Deadlock issue?


Thanks,
Maunik

saminath sanjai

unread,
Dec 12, 2012, 7:15:02 AM12/12/12
to android-...@googlegroups.com
Could attach the complete crash report (ANR...)







--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/nRN-CnSJKS4J.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.

Maunik Shah

unread,
Dec 12, 2012, 11:05:04 AM12/12/12
to android-...@googlegroups.com
Please find attached ANR report
traces.txt

Christopher Tate

unread,
Dec 12, 2012, 5:16:20 PM12/12/12
to android-...@googlegroups.com
This is a bug in the Android framework involving teardown handling when input destinations (usually activity windows) go away and the corresponding input channels get torn down while there are pending undelivered keypresses (in this case, crucially, shortcut keys that will wind up causing new activities to be started).  I believe the fix went out in Android 4.2.*; I know it's in AOSP.  You can see the fix patch here -- it's straightforward and likely to be an easy cherrypick into whatever base OS sources you're using:

https://android.googlesource.com/platform/frameworks/base/+/074b8b7cf19d128f16e0de12bc2fc58e7438ec37

Good luck!

(Ideally, of course, you'd snap up to developing on the latest release, but I realize that is seldom practical for OEMs with products already in the pipeline.)

--
christopher tate
android framework engineer


To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/4d_tiDWJ7fYJ.

Maunik Shah

unread,
Dec 14, 2012, 11:18:41 AM12/14/12
to android-...@googlegroups.com, ct...@google.com
Thanks Christopher Tate for the solution and quick reply. :)
Reply all
Reply to author
Forward
0 new messages