分享

Android ANR / NE / JE / SWT « Shooting's Blog

 astrotycoon 2018-06-07

Terminology

  • ANR = Application Not Response
  • NE = Native Exception
  • JE = Jave Exception
  • SWT = Software Watchdog Timeout

What can see in mobilelog?

  • main_log
    • AEE/AED
    • Dumping
      • ex. Dumping EXP/ANR, Dumping EXP/SWT, ...
  • events_log
    • am_anr
    • am_crash
    • watchdog
  • crash_log

What can see in db?

  • SYS_ANDROID_EVENT_LOG
    • am_anr
    • am_crash
    • watchdog
  • SWT_JBT_TRACES
    • callstack
  • SYS_ANDROID_LOG
    • Part of main_log (not as detail as main_log)
  • SYS_LIBRANK
    • memory usage
  • SYS_MEMORY_LOG
    • memory usage
  • NOTICE!
    • Time recorded in EVENT_LOG may be different from time in exp_main.
    • Exception occurs -> AEE collect data and write into exp_main takes some time.

SWT

  • How does SWT work?
    • Each 30 seconds, it will send event to important threads. (ex. mainthread, android.ui, android.display, android.fg)
    • Go to sleep.
    • Time up (30s later), it will check whether it's able to get response from those threads. If not, it will do predump.
    • NOTICE! It may not be exactly 30s, because if system is busy, then it may not be able to work.
SYS_ANDROID_LOG
11-17 01:46:04.468   947  1509 W Watchdog: SWT Watchdog before wait current time:549298598
11-17 01:46:04.468   947  1509 W Watchdog: SWT Watchdog before wait start:549298598
11-17 01:46:04.468   947  1509 W Watchdog: SWT Watchdog before wait CHECK_INTERVAL:30000
11-17 01:46:34.468   947  1509 W Watchdog: SWT Watchdog after wait current time:549328599
  • How does SWT work? (part2)

    • 透過拿不拿的到 Lock 的方式來看系統是否卡住
    • 會去每分鐘polling四個thread來看是否卡住
      • main thread
      • android.ui
      • android.display
      • android.fg
    • 1 mins block --> timeout (30 seconds before will have predump)
  • Important logs

SYS_ANDROID_EVENT_LOG
11-17 01:47:12.088   947  1509 I watchdog: Blocked in handler on main thread (main)
SYS_ANDROID_LOG
# 30s block predump
11-17 01:46:04.468   947  1509 W Watchdog: SWT Watchdog before wait current time:549298598
11-17 01:46:04.468   947  1509 W Watchdog: SWT Watchdog before wait start:549298598
11-17 01:46:04.468   947  1509 W Watchdog: SWT Watchdog before wait CHECK_INTERVAL:30000
11-17 01:46:34.468   947  1509 W Watchdog: SWT Watchdog after wait current time:549328599
    
# signal by someone    
11-17 01:46:42.087   947  1509 W Watchdog: SWT Watchdog before wait current time:549336217
11-17 01:46:42.087   947  1509 W Watchdog: SWT Watchdog before wait start:549336217
11-17 01:46:42.087   947  1509 W Watchdog: SWT Watchdog before wait CHECK_INTERVAL:30000
11-17 01:47:12.087   947  1509 W Watchdog: SWT Watchdog after wait current time:549366218

# 30s block again SWT occur
11-17 01:47:12.088   947  1509 E Watchdog: **SWT happen **Blocked in handler on main thread (main)    
11-17 01:47:21.834   947  1509 I Watchdog_N: dumpKernelStacks
11-17 01:47:21.872   947  1509 V Watchdog: ** save all info before killnig system server **
11-17 01:47:21.897   947  1509 D AES     :       cause : system_server_watchdog
11-17 01:47:21.924 13965 13965 D AEE/AED :   Type:system_server_watchdog
11-17 01:47:21.924 13965 13965 I AEE/AED : system_server_watchdog
main_log
11-17 01:47:12.088914   947  1509 D AEE/RTT_LIB: aee_exception_running: send req
11-17 01:47:12.089258   947  1509 D AEE/RTT_LIB: Rtt waiting daemon finish the job...
11-17 01:47:12.089799 26846 26846 D AEE/AED : $===AEE===AEE===AEE===$
11-17 01:47:12.089884 26846 26846 D AEE/AED : p 0 poll events 1 revents 1
11-17 01:47:12.090030 26846 26846 D AEE/AED : requesting from: pid=947 cmd=9
11-17 01:47:12.090098 26846 26846 D AEE/AED : Go RTT_AEE_GET_EXCEPTION_RUNNING

11-17 01:47:21.913622 13965 13965 I AEE/AED : FATAL 'SWT' raised
11-17 01:47:21.913700 13965 13965 I AEE/AED : Dumping EXP/SWT

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多