tips for research in /data/anr/trace.txt

3,515 views
Skip to first unread message

stanly

unread,
Jan 19, 2011, 10:24:47 PM1/19/11
to android-...@googlegroups.com, 郭嫚婷
hi all,

when my android hangs, the ANR(or Watchdog?) will write stacks in /data/anr/trace.txt,
but I really want to know how get more hint in traces.txt,
for my knows, when main thread not response for 30 seconds,
system will write fro traces.txt first time, then write for second time in 1 minutes not response,
when we start to read traces.txt, I have some direction but doesn't know correct or not?
1) 
should we start from ""android.server.ServerThread"?
is this  process owns most hint for android hangs?
but actually I also can't realize system hangs from ""android.server.ServerThread"
such as 
/////// whan system hangs ////////////
"android.server.ServerThread" prio=5 tid=8 NATIVE
  | group="main" sCount=1 dsCount=0 s=N obj=0x45edae50 self=0x21e398
  | sysTid=1101 nice=-2 sched=0/0 cgrp=default handle=2221272
  at android.view.Surface.unlockCanvasAndPost(Native Method)
  at android.view.ViewRoot.draw(ViewRoot.java:1431)
  at android.view.ViewRoot.performTraversals(ViewRoot.java:1163)
  at android.view.ViewRoot.handleMessage(ViewRoot.java:1727)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:123)
  at com.android.server.ServerThread.run(SystemServer.java:528)
/////////////////////////////////////////////////////

2)
should we take care about process status,
such as NATIVE, WAIT, TIMED_WAIT...
does WAIT status affect android system?
does there exist more and more WAIT status process will increase hangs risk?
such as
/////// whan system hangs ////////////
"DHCP Handler Thread" prio=5 tid=44 WAIT
"GpsLocationProvider" prio=5 tid=39 TIMED_WAIT
"ThrottleService" prio=5 tid=38 WAIT
"LocationManagerService" prio=5 tid=37 WAIT
"WifiWatchdogThread" prio=5 tid=34 WAIT
"backup" prio=5 tid=32 WAIT
"AudioService" prio=5 tid=29 WAIT
"MountService" prio=5 tid=27 WAIT
"Tethering" prio=5 tid=26 WAIT
"WifiService" prio=5 tid=25 WAIT
"ConnectivityThread" prio=5 tid=24 TIMED_WAIT
"InputDispatcher" prio=5 tid=21 TIMED_WAIT
"WindowManagerPolicy" prio=5 tid=20 WAIT
"WindowManager" prio=5 tid=18 WAIT
"PowerManagerService" prio=5 tid=16 TIMED_WAIT
"SyncHandlerThread" prio=5 tid=14 WAIT
"AccountManagerService" prio=5 tid=13 WAIT
"PackageManager" prio=5 tid=11 WAIT
"ProcessStats" prio=5 tid=10 TIMED_WAIT
"ActivityManager" prio=5 tid=9 WAIT
/////////////////////////////////////////////////////

3)
my traces.txt first record is in "pid 1088 at 2000-01-07 14:07:55",
also, I used "logcat -v time" to store time stamp,
if traces.txt is writed when android not response for 30 seconds,
so should I take a look for what happen in "14:07:25" of logcat?
but from my logcat I can't see anything,
//////from my logcat/////////////////////////
01-07 14:07:25.158 D/wpa_supplicant( 1157): wpa_driver_tista_driver_cmd RSSI-APPROX
01-07 14:07:25.158 D/wpa_supplicant( 1157): rssi-approx command
01-07 14:07:25.158 D/wpa_supplicant( 1157): wpa_driver_tista_driver_cmd LINKSPEED
01-07 14:07:25.158 D/wpa_supplicant( 1157): Link Speed command
01-07 14:07:25.158 D/wpa_supplicant( 1157): buf LinkSpeed 54
/////////////////////////////////////////////////////// 

thanks for your time to figure out my problem,
but I really need some tips to realize my hangs problem.


Stanly

Dianne Hackborn

unread,
Jan 20, 2011, 1:02:03 AM1/20/11
to android-...@googlegroups.com, 郭嫚婷
For the system process, the "main" thread does not matter -- actually the watchdog that goes off there is monitoring lots of threads and individual objects to try to detect deadlocks.

To find the problem -- fundamentally you just need to look for a deadlock.  Look for stacks that are stopped waiting while holding a lock.  Most often, you will find a cycle -- thread A is waiting for B, which is waiting for a lock held by A.

Not infrequently there are three threads involved, not just a simple deadlock between two.

Very often you will see ActivityManagerService involved.  If you see a stack with code running significantly in ActivityManagerService or WindowManagerService, that is probably a good place to start following  the strings.

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
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.



--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

tstanly

unread,
Jan 20, 2011, 1:55:36 AM1/20/11
to android-platform
thanks for your suggestion,
according to your point, we must to find out "deadlock"from
traces.txt,
so for example, if A is wait for B and B is wait for A,
then how can I find out from the trace?

such as this? I list two process on WAIT status,

////////////////
"ThrottleService" prio=5 tid=38 WAIT
| group="main" sCount=1 dsCount=0 s=N obj=0x45fbf268 self=0x309190
| sysTid=1174 nice=0 sched=0/0 cgrp=default handle=3183312
at java.lang.Object.wait(Native Method)
- waiting on <0x45f6f700> (a android.os.MessageQueue)
at java.lang.Object.wait(Object.java:288)
at android.os.MessageQueue.next(MessageQueue.java:146)
at android.os.Looper.loop(Looper.java:110)
at android.os.HandlerThread.run(HandlerThread.java:60)

"WifiService" prio=5 tid=25 WAIT
| group="main" sCount=1 dsCount=0 s=N obj=0x45fff168 self=0x298aa0
| sysTid=1126 nice=0 sched=0/0 cgrp=default handle=2722784
at java.lang.Object.wait(Native Method)
- waiting on <0x45fe6210> (a android.os.MessageQueue)
at java.lang.Object.wait(Object.java:288)
at android.os.MessageQueue.next(MessageQueue.java:146)
at android.os.Looper.loop(Looper.java:110)
at android.os.HandlerThread.run(HandlerThread.java:60)
//////////////////////////////////////////////////////////////////////////////

from these two WAITING process,
I don't know what is "ThrottleService" wait for?
the only clue is ->
- waiting on <0x45f6f700> (a android.os.MessageQueue)

so please give me more information,
thanks!

Stanly
> > android-platfo...@googlegroups.com<android-platform%2Bunsubscrib e...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
Reply all
Reply to author
Forward
0 new messages