web-dev-qa-db-ja.com

Android /data/anr/traces.txtファイルを分析する方法は?

AndroidアプリでANRエラーが発生しました。

トレースは下にあります

「メイン」と「スレッド-20153」はANRの主な問題ですか?

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)
"main" prio=5 tid=1 SUSPENDED
  | group="main" sCount=2 dsCount=1 obj=0x40aee490 self=0x1fbad70
  | sysTid=3805 Nice=0 sched=0/0 cgrp=default handle=1074664744
  | schedstat=( 378517060062 270739989762 791048 ) utm=33581 stm=4270 core=0
  at Android.app.ActivityThread.performResumeActivity(ActivityThread.Java:~2812)
  at Android.app.ActivityThread.handleResumeActivity(ActivityThread.Java:2851)
  at Android.app.ActivityThread$H.handleMessage(ActivityThread.Java:1287)
  at Android.os.Handler.dispatchMessage(Handler.Java:99)
  at Android.os.Looper.loop(Looper.Java:154)
  at Android.app.ActivityThread.main(ActivityThread.Java:4945)
  at Java.lang.reflect.Method.invokeNative(Native Method)
  at Java.lang.reflect.Method.invoke(Method.Java:511)
  at com.Android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.Java:784)
  at com.Android.internal.os.ZygoteInit.main(ZygoteInit.Java:551)
  at dalvik.system.NativeStart.main(Native Method)

"Thread-20153" prio=5 tid=22 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x41463760 self=0x3018ea0
  | sysTid=7466 Nice=0 sched=0/0 cgrp=default handle=43164240
  | schedstat=( 32867433 91186523 62 ) utm=2 stm=1 core=0
  at Java.lang.VMThread.sleep(Native Method)
  at Java.lang.Thread.sleep(Thread.Java:1047)
  at Java.lang.Thread.sleep(Thread.Java:1029)
  at com.mocoplex.adlib.AdlibManager$b.run(AdlibManager.Java:1068)

"Timer-3" prio=5 tid=18 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x4114a748 self=0x2984f48
  | sysTid=5953 Nice=0 sched=0/0 cgrp=default handle=46807576
  | schedstat=( 48645025 59570314 230 ) utm=4 stm=0 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x4114a748> (a Java.util.Timer$TimerImpl)
  at Java.lang.Object.wait(Object.Java:401)
  at Java.util.Timer$TimerImpl.run(Timer.Java:238)

"Timer-2" prio=5 tid=20 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x41103688 self=0x2a53738
  | sysTid=5861 Nice=0 sched=0/0 cgrp=default handle=43212688
  | schedstat=( 48461919 64544676 234 ) utm=4 stm=0 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x41103688> (a Java.util.Timer$TimerImpl)
  at Java.lang.Object.wait(Object.Java:401)
  at Java.util.Timer$TimerImpl.run(Timer.Java:238)

"Binder Thread #4" prio=5 tid=16 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x410d7a90 self=0x2877ef8
  | sysTid=4496 Nice=0 sched=0/0 cgrp=default handle=43222816
  | schedstat=( 556243916 622314442 2261 ) utm=30 stm=25 core=0
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #3" prio=5 tid=21 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40e9bd30 self=0x296a800
  | sysTid=3971 Nice=0 sched=0/0 cgrp=default handle=43484856
  | schedstat=( 755767858 956115700 2837 ) utm=47 stm=28 core=0
  at dalvik.system.NativeStart.run(Native Method)

"Timer-1" prio=5 tid=12 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40da4778 self=0x2817d28
  | sysTid=3955 Nice=0 sched=0/0 cgrp=default handle=42812624
  | schedstat=( 78033460 63385008 360 ) utm=3 stm=4 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40da4778> (a Java.util.Timer$TimerImpl)
  at Java.lang.Object.wait(Object.Java:401)
  at Java.util.Timer$TimerImpl.run(Timer.Java:238)

"Thread-19213" prio=5 tid=14 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40f47bc0 self=0x28397d8
  | sysTid=3894 Nice=0 sched=0/0 cgrp=default handle=41749600
  | schedstat=( 6582580563 4471832242 16030 ) utm=317 stm=341 core=0
  at dalvik.system.NativeStart.run(Native Method)

"AsyncTask #1" prio=5 tid=19 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40ec6b60 self=0x2799b10
  | sysTid=3886 Nice=10 sched=0/0 cgrp=default handle=41517920
  | schedstat=( 85784919 298645016 925 ) utm=5 stm=3 core=1
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40ec70f8> (a Java.lang.VMThread) held by tid=19 (AsyncTask #1)
  at Java.lang.Thread.parkFor(Thread.Java:1250)
  at Sun.misc.Unsafe.park(Unsafe.Java:323)
  at Java.util.concurrent.locks.LockSupport.park(LockSupport.Java:157)
  at Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.Java:2022)
  at Java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.Java:413)
  at Java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.Java:1009)
  at Java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.Java:1069)
  at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:569)
  at Java.lang.Thread.run(Thread.Java:864)

"GAThread" prio=5 tid=17 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40e14cd8 self=0x265ea78
  | sysTid=3849 Nice=0 sched=0/0 cgrp=default handle=40098064
  | schedstat=( 98105010984 112702484189 420613 ) utm=8608 stm=1202 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40e14f48> (a Java.lang.VMThread) held by tid=17 (GAThread)
  at Java.lang.Thread.parkFor(Thread.Java:1250)
  at Sun.misc.Unsafe.park(Unsafe.Java:323)
  at Java.util.concurrent.locks.LockSupport.park(LockSupport.Java:157)
  at Java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.Java:2022)
  at Java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.Java:413)
  at com.google.analytics.tracking.Android.GAThread.run(GAThread.Java:518)

"Timer-0" prio=5 tid=15 TIMED_WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40e0b258 self=0x2644908
  | sysTid=3847 Nice=0 sched=0/0 cgrp=default handle=39852224
  | schedstat=( 8728025 27526859 49 ) utm=0 stm=0 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40e0b258> (a Java.util.Timer$TimerImpl)
  at Java.lang.Object.wait(Object.Java:401)
  at Java.util.Timer$TimerImpl.run(Timer.Java:238)

"CookieSyncManager" prio=5 tid=13 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40dd51d8 self=0x2205750
  | sysTid=3839 Nice=10 sched=0/0 cgrp=default handle=35690744
  | schedstat=( 3601070 48522953 21 ) utm=0 stm=0 core=0
  at Android.os.MessageQueue.nativePollOnce(Native Method)
  at Android.os.MessageQueue.next(MessageQueue.Java:118)
  at Android.os.Looper.loop(Looper.Java:124)
  at Android.webkit.WebSyncManager.run(WebSyncManager.Java:90)
  at Android.webkit.CookieSyncManager.run(CookieSyncManager.Java:61)
  at Java.lang.Thread.run(Thread.Java:864)

"WebViewCoreThread" prio=5 tid=11 SUSPENDED
  | group="main" sCount=1 dsCount=0 obj=0x40dd1000 self=0x21d3268
  | sysTid=3837 Nice=0 sched=0/0 cgrp=default handle=35024464
  | schedstat=( 108778259167 88950927721 209209 ) utm=9772 stm=1105 core=0
  at Android.os.MessageQueue.nativePollOnce(Native Method)
  at Android.os.MessageQueue.next(MessageQueue.Java:118)
  at Android.os.Looper.loop(Looper.Java:124)
  at Android.webkit.WebViewCore$WebCoreThread.run(WebViewCore.Java:751)
  at Java.lang.Thread.run(Thread.Java:864)

"Binder Thread #2" prio=5 tid=10 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40dab048 self=0x21b4f78
  | sysTid=3817 Nice=0 sched=0/0 cgrp=default handle=35045376
  | schedstat=( 753906254 1313110342 2682 ) utm=62 stm=13 core=0
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #1" prio=5 tid=9 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40daa018 self=0x220b6c0
  | sysTid=3816 Nice=0 sched=0/0 cgrp=default handle=35448760
  | schedstat=( 763366698 866455078 2684 ) utm=56 stm=20 core=0
  at dalvik.system.NativeStart.run(Native Method)

"FinalizerWatchdogDaemon" daemon prio=5 tid=8 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40da5910 self=0x21f8778
  | sysTid=3815 Nice=0 sched=0/0 cgrp=default handle=35648680
  | schedstat=( 19226068 112762454 289 ) utm=1 stm=0 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40af5ee8> (a Java.lang.Daemons$FinalizerWatchdogDaemon)
  at Java.lang.Object.wait(Object.Java:364)
  at Java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.Java:218)
  at Java.lang.Thread.run(Thread.Java:864)

"FinalizerDaemon" daemon prio=5 tid=7 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40da57b8 self=0x21a4a20
  | sysTid=3814 Nice=0 sched=0/0 cgrp=default handle=35665600
  | schedstat=( 5843750080 8033416627 35050 ) utm=463 stm=121 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40ae45e8> (a Java.lang.ref.ReferenceQueue)
  at Java.lang.Object.wait(Object.Java:401)
  at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:102)
  at Java.lang.ref.ReferenceQueue.remove(ReferenceQueue.Java:73)
  at Java.lang.Daemons$FinalizerDaemon.run(Daemons.Java:173)
  at Java.lang.Thread.run(Thread.Java:864)

"ReferenceQueueDaemon" daemon prio=5 tid=6 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40da5650 self=0x21ce2e0
  | sysTid=3813 Nice=0 sched=0/0 cgrp=default handle=35653416
  | schedstat=( 1158782901 1858612107 6973 ) utm=98 stm=17 core=0
  at Java.lang.Object.wait(Native Method)
  - waiting on <0x40ae4510> 
  at Java.lang.Object.wait(Object.Java:364)
  at Java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.Java:133)
  at Java.lang.Thread.run(Thread.Java:864)

"Compiler" daemon prio=5 tid=5 VMWAIT
  | group="system" sCount=1 dsCount=0 obj=0x40da5560 self=0x21ee180
  | sysTid=3812 Nice=0 sched=0/0 cgrp=default handle=34074560
  | schedstat=( 1770019 3204346 7 ) utm=0 stm=0 core=0
  at dalvik.system.NativeStart.run(Native Method)

"JDWP" daemon prio=5 tid=4 VMWAIT
  | group="system" sCount=1 dsCount=0 obj=0x40da5478 self=0x21f1988
  | sysTid=3811 Nice=0 sched=0/0 cgrp=default handle=34075744
  | schedstat=( 681671184 898101870 8811 ) utm=24 stm=44 core=0
  at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
  | group="system" sCount=0 dsCount=0 obj=0x40da5380 self=0x220ebd0
  | sysTid=3809 Nice=0 sched=0/0 cgrp=default handle=34074272
  | schedstat=( 6927491 39001465 8 ) utm=0 stm=0 core=0
  at dalvik.system.NativeStart.run(Native Method)

"GC" daemon prio=5 tid=2 VMWAIT
  | group="system" sCount=1 dsCount=0 obj=0x40da52a0 self=0x20801f0
  | sysTid=3807 Nice=0 sched=0/0 cgrp=default handle=35471536
  | schedstat=( 2660827614 3416412375 2552 ) utm=254 stm=12 core=0
  at dalvik.system.NativeStart.run(Native Method)

----- end 3805 -----

しかし、問題のあるコードがどこにあるのかわかりません。

これをどのように解釈しますか?

トレースが長すぎて、質問が素朴すぎます。エラー全体を説明する必要はありません。主題の解釈方法をアドバイスしてください。

16
yountae.kang

これまでのところ、問題はないようです。ここで確認できるように、メインスレッドは中断されており、WebViewCoreThreadと呼ばれるもう1つのスレッドも中断されています。これらの2つを除いて、他のすべてのスレッドは、従来の待機または時間指定の待機を実行するか、単に実行しているだけで問題ないようです。

ここでANRが発生した可能性がある2つの理由は、2つのスレッドのいずれかが無期限に中断され、しばらく待った後、Android(システム)がそれらが死んだと思ったためです。 、たとえば数秒、したがってANRをスローします。

これらのスレッドのいずれかにブレークポイントがあるかどうか、またはこれらのスレッドのいずれかがgcにつながるオブジェクトのインスタンス化を含む重い操作を行っているかどうかを確認することをお勧めします。これにより、スレッドが一時停止モードに入る可能性もあります。

また、ログをチェックして、システムプロセスのいずれかを強制終了するウォッチドッグのサインを確認してください。これを理解するのに役立つ可能性があります。

3
stack_ved