4

我收到有关我的 Android 应用程序的错误报告,其中涉及 ANR keyDispatchingTimedOut。令人惊讶的是,此报告中的堆栈跟踪不包含我自己的任何类。

我还检查了我的 onPause() 和 onResume() 方法,它们应该不需要很长时间。只完成了一些资源清理工作,对于 onPause() 我预计最坏情况下最多为 1 秒(但完全由必须完成的事情引起,在其他地方我会造成内存泄漏。

我将在这里发布例外情况,可能有人知道它可能来自哪里:

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0 hwl=0 hwll=0)
"main" prio=5 tid=1 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x400275d8 self=0xd050
  | sysTid=1372 nice=0 sched=0/0 cgrp=default handle=-1345002112
  | schedstat=( 11662176940194 5648544984518 10145639 )
  at com.android.server.SystemServer.init1(Native Method)
  at com.android.server.SystemServer.main(SystemServer.java:1073)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:507)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607)
  at dalvik.system.NativeStart.main(Native Method)

"DHCP Handler Thread" prio=5 tid=67 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40e9bfa8 self=0x19c6308
  | sysTid=24486 nice=0 sched=0/0 cgrp=default handle=25164024
  | schedstat=( 366210 41748048 6 )
  at android.os.MessageQueue.nativePollOnce(Native Method)
  at android.os.MessageQueue.next(MessageQueue.java:119)
  at android.os.Looper.loop(Looper.java:127)
  at android.os.HandlerThread.run(HandlerThread.java:60)

"WifiWatchdogThread" prio=5 tid=68 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x41244978 self=0x17dbef0
  | sysTid=24466 nice=0 sched=0/0 cgrp=default handle=15264984
  | schedstat=( 701905 7476806 13 )
  at android.os.MessageQueue.nativePollOnce(Native Method)
  at android.os.MessageQueue.next(MessageQueue.java:119)
  at android.os.Looper.loop(Looper.java:127)
  at com.android.server.WifiWatchdogService$WifiWatchdogThread.run        (WifiWatchdogService.java:987)

"WifiMonitor" prio=5 tid=62 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4131e810 self=0xd08208
  | sysTid=24464 nice=0 sched=0/0 cgrp=default handle=12776888
  | schedstat=( 333160420 1889770493 2621 )
  at android.net.wifi.WifiNative.waitForEvent(Native Method)
  at android.net.wifi.WifiMonitor$MonitorThread.run(WifiMonitor.java:203)

"android.hardware.SensorManager$SensorThread" prio=10 tid=41 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40fd23c8 self=0xb7fab0
  | sysTid=12065 nice=-8 sched=0/0 cgrp=default handle=17642104
  | schedstat=( 110688049235 273218872268 669479 )
  at android.hardware.SensorManager.sensors_data_poll(Native Method)
  at android.hardware.SensorManager$SensorThread$SensorThreadRunnable.run    (SensorManager.java:457)
  at java.lang.Thread.run(Thread.java:1027)

"Binder Thread #16" prio=5 tid=60 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40d10dd0 self=0x7b81d0
  | sysTid=3142 nice=0 sched=0/0 cgrp=default handle=7991208
  | schedstat=( 11422702482849 5701657716702 9785642 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #15" prio=5 tid=58 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40b781e0 self=0x806250
  | sysTid=2769 nice=0 sched=0/0 cgrp=default handle=11040328
  | schedstat=( 11575800474431 5698023835937 9772315 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #14" prio=5 tid=55 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40bf8fb0 self=0x4bb9d0
  | sysTid=2753 nice=0 sched=0/0 cgrp=default handle=3581728
  | schedstat=( 11386876678429 5731225067581 9692452 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #13" prio=5 tid=66 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40ba0b88 self=0x93b500
  | sysTid=2087 nice=0 sched=0/0 cgrp=default handle=5284592
  | schedstat=( 11618146360340 5720185427379 9899076 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #12" prio=5 tid=65 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40a9c6f0 self=0x551350
  | sysTid=2051 nice=0 sched=0/0 cgrp=default handle=4866248
  | schedstat=( 11450612946761 5715914702060 9837910 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #11" prio=5 tid=64 SUSPENDED
  | group="main" sCount=1 dsCount=0 obj=0x40bc5890 self=0x757f70
  | sysTid=2049 nice=0 sched=0/0 cgrp=default handle=8382088
  | schedstat=( 11574565428602 5755652681331 9814613 )
  at android.util.Log.println_native(Native Method)
  at android.util.Slog.w(Slog.java:60)
  at com.android.server.WifiService.getScanResults(WifiService.java:3184)
  at android.net.wifi.IWifiManager$Stub.onTransact(IWifiManager.java:126)
  at android.os.Binder.execTransact(Binder.java:320)
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #10" prio=5 tid=63 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40bbdcd0 self=0x551e40
  | sysTid=2024 nice=0 sched=0/0 cgrp=default handle=9934888
  | schedstat=( 11442461820647 5738453187888 9866071 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #9" prio=5 tid=61 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40a71b90 self=0x4f2148
  | sysTid=2012 nice=0 sched=0/0 cgrp=default handle=7152360
  | schedstat=( 11412723570422 5737569459835 9856082 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #8" prio=5 tid=59 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40a01fd8 self=0x60ca40
  | sysTid=1628 nice=0 sched=0/0 cgrp=default handle=5809144
  | schedstat=( 11483056913767 5750414339519 9921476 )
  at dalvik.system.NativeStart.run(Native Method)

"pool-1-thread-1" prio=5 tid=57 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x40aec4e0 self=0x609538
  | sysTid=1612 nice=0 sched=0/0 cgrp=default handle=5159248
  | schedstat=( 3046508787 1064334014940 196511 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x40aec668> (a java.lang.VMThread)
  at java.lang.Thread.parkFor(Thread.java:1443)
  at java.lang.LangAccessImpl.parkFor(LangAccessImpl.java:48)
  at sun.misc.Unsafe.park(Unsafe.java:337)
  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:411)
  at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1021)
  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1081)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
  at java.lang.Thread.run(Thread.java:1027)

"RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@409f8528" daemon prio=5     tid=56 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x409f8730 self=0x7f49d0
  | sysTid=1604 nice=0 sched=0/0 cgrp=default handle=7101040
  | schedstat=( 1492370720 1062000579822 183346 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x4088bc80> (a java.lang.ref.ReferenceQueue)
  at java.lang.Object.wait(Object.java:395)
  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:107)
  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:80)
  at org.apache.http.impl.conn.tsccm.RefQueueWorker.run(RefQueueWorker.java:102)
  at java.lang.Thread.run(Thread.java:1027)

"GpsLocationProvider" prio=5 tid=54 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40924278 self=0x5aac30
  | sysTid=1593 nice=0 sched=0/0 cgrp=default handle=5213160
  | schedstat=( 53695556564 4105485168504 314554 )
  at android.os.MessageQueue.nativePollOnce(Native Method)
  at android.os.MessageQueue.next(MessageQueue.java:119)
  at android.os.Looper.loop(Looper.java:127)
  at com.android.server.location.GpsLocationProvider$GpsLocationProviderThread.run    (GpsLocationProvider.java:2627)

"GpsNetwork" prio=5 tid=53 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40918f30 self=0x7a3280
  | sysTid=1592 nice=10 sched=0/0 cgrp=bg_non_interactive handle=5596240
  | schedstat=( 3941528407 4715350128138 190744 )
  at android.os.MessageQueue.nativePollOnce(Native Method)
  at android.os.MessageQueue.next(MessageQueue.java:119)
  at android.os.Looper.loop(Looper.java:127)
  at com.android.server.location.GpsLocationProvider$GpsNetworkThread.run    (GpsLocationProvider.java:2640)

"pd_api_DeferredActionThread" prio=5 tid=52 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4091ff60 self=0x60a838
  | sysTid=1590 nice=0 sched=0/0 cgrp=default handle=8651504
  | schedstat=( 457944183704 2556608550419 1632941 )
  at dalvik.system.NativeStart.run(Native Method)

"RefQueueWorker@org.apache.http.impl.conn.tsccm.ConnPoolByRoute@4094f298" daemon prio=5 tid=51 WAIT
  | group="main" sCount=1 dsCount=0 obj=0x409ccd20 self=0x4db280
  | sysTid=1575 nice=0 sched=0/0 cgrp=default handle=5202200
  | schedstat=( 1599853387 1042935485993 183397 )
  at java.lang.Object.wait(Native Method)
  - waiting on <0x408ddf60> (a java.lang.ref.ReferenceQueue)
  at java.lang.Object.wait(Object.java:395)
  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:107)
  at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:80)
  at org.apache.http.impl.conn.tsccm.RefQueueWorker.run(RefQueueWorker.java:102)
  at java.lang.Thread.run(Thread.java:1027)

"Binder Thread #7" prio=5 tid=50 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40923718 self=0x4db8d0
  | sysTid=1573 nice=0 sched=0/0 cgrp=default handle=8114928
  | schedstat=( 12123622466944 5905026153897 10044543 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #6" prio=5 tid=49 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4095ddf8 self=0x4f84a8
  | sysTid=1572 nice=0 sched=0/0 cgrp=default handle=7427944
  | schedstat=( 11386062986105 5713769168163 9948969 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #5" prio=5 tid=48 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x4098e360 self=0x7fb658
  | sysTid=1571 nice=0 sched=0/0 cgrp=default handle=8364584
  | schedstat=( 12129762418333 5854713838622 10020470 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #4" prio=5 tid=47 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x409c3738 self=0x7866a8
  | sysTid=1570 nice=0 sched=0/0 cgrp=default handle=7592008
  | schedstat=( 11479118193718 5704348663883 9891752 )
  at dalvik.system.NativeStart.run(Native Method)

"Binder Thread #3" prio=5 tid=46 NATIVE
  | group="main" sCount=1 dsCount=0 obj=0x40ac0908 self=0x5ae448
  | sysTid=1569 nice=0 sched=0/0 cgrp=default handle=6764560
  | schedstat=( 12284007139602 5890366395349 10076640 )
  at dalvik.system.NativeStart.run(Nat...
4

1 回答 1

0

我对此的发现(但我不太确定):当我自己的应用程序中的某些内容阻塞太长时间时,就会发生这种情况。因此,当 onPause()/onResume() 等待太长时间直到它们返回给调用者时,可能会发生这种超时。

我不太清楚:这个超时时间有多长,意味着应用程序可以拥有这些方法来执行一些内部任务多长时间......

于 2013-03-07T08:53:31.893 回答