0

我使用Starling Framework开发了AIR上的游戏。我收到很多来自用户的ANR。游戏涉及拖放机制,它是基于回合的游戏,所以有一个计时器在后台运行。ANR Android keyDispatchingTimedOut(AIR 4.0)

许多ANR的堆栈跟踪类似于下面的转储。

DALVIK THREADS:(mutexes: tll=0 tsl=0 tscl=0 ghl=0)  
"main" prio=5 tid=1 NATIVE  
| group="main" sCount=1 dsCount=0 obj=0x41f44508 self=0x4003e008  
| sysTid=5019 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1075220272  
| schedstat=(312982116691 68901855364 485609) utm=28822 stm=2476 core=1  
#00 pc 0000dc80 /system/lib/libc.so (__futex_syscall3+8)  
#01 pc 00012db4 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)  
#02 pc 00012e10 /system/lib/libc.so (__pthread_cond_timedwait+60)  
#03 pc 00012ea8 /system/lib/libc.so (pthread_join+108)  
#04 pc 001dc775 /data/data/air.com.macarongames.riskokey/lib/libCore.so 

at com.adobe.air.customHandler.callTimeoutFunction(Native Method) 
at com.adobe.air.customHandler.handleMessage(customHandler.java:22) 
at android.os.Handler.dispatchMessage(Handler.java:99) 
at android.os.Looper.loop(Looper.java:137) 
at android.app.ActivityThread.main(ActivityThread.java:4867) 
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:1007) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) 
at dalvik.system.NativeStart.main(Native Method) 
"Thread-2107" prio=5 tid=22 NATIVE 
| group="main" sCount=1 dsCount=0 obj=0x42a55750 self=0x6042a7d0 
| sysTid=5946 nice=-16 sched=0/0 cgrp=[no-cpu-subsys] handle=1615378384 
| schedstat=(689605688 91613777 1862) utm=56 stm=12 core=0 
#00 pc 0000dc80 /system/lib/libc.so (__futex_syscall3+8) 
#01 pc 00012174 /system/lib/libc.so 
#02 pc 0012ad95 /data/data/air.com.macarongames.riskokey/lib/libCore.so 
#03 pc 0010e787 /data/data/air.com.macarongames.riskokey/lib/libCore.so 
#04 pc 001aa151 /data/data/air.com.macarongames.riskokey/lib/libCore.so 
at dalvik.system.NativeStart.run(Native Method) 

"AudioTrack" prio=10 tid=21 NATIVE 
| group="main" sCount=1 dsCount=0 obj=0x42a861c0 self=0x6042c910 
| sysTid=5945 nice=-16 sched=0/0 cgrp=[no-cpu-subsys] handle=1614836480 
| schedstat=(649810821 215698216 7041) utm=24 stm=40 core=1 
#00 pc 0000d300 /system/lib/libc.so (nanosleep+12) 
#01 pc 0001a89f /system/lib/libc.so (usleep+30) 
#02 pc 0003a2ef /system/lib/libmedia.so (android::AudioTrack::processAudioBuffer(android::sp<android::AudioTrack::AudioTrackThread> const&)+402) 
#03 pc 0003a3ab /system/lib/libmedia.so (android::AudioTrack::AudioTrackThread::threadLoop()+70) 
#04 pc 0001103b /system/lib/libutils.so (android::Thread::_threadLoop(void*)+94) 
#05 pc 0004b44b /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+66) 
#06 pc 00010bb5 /system/lib/libutils.so 
#07 pc 00012d70 /system/lib/libc.so (__thread_entry+48) 
#08 pc 000124c8 /system/lib/libc.so (pthread_create+172) 
at dalvik.system.NativeStart.run(Native Method) 

"AsyncTask #3" prio=5 tid=17 WAIT 
| group="main" sCount=1 dsCount=0 obj=0x42b02af0 self=0x60e4da28 
| sysTid=5178 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=1540363888 
| schedstat=(21789549 60577394 30) utm=2 stm=0 core=0 
at java.lang.Object.wait(Native Method) 
- waiting on <0x42a4d218> (a java.lang.VMThread) held by tid=17 (AsyncTask #3) 
at java.lang.Thread.parkFor(Thread.java:1231) 
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:856) 

"AsyncTask #2" prio=5 tid=23 WAIT 
| group="main" sCount=1 dsCount=0 obj=0x42a3cdc8 self=0x5bca8f30 
| sysTid=5167 nice=10 sched=0/0 cgrp=[no-cpu-subsys] handle=1539370024 
| schedstat=(109405514 857849122 431) utm=8 stm=2 core=1 
at java.lang.Object.wait(Native Method) 
- waiting on <0x42a752a8> (a java.lang.VMThread) held by tid=23 (AsyncTask #2) 
at java.lang.Thread.parkFor(Thread.java:1231) 
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:856) 

"Timer-1" prio=5 tid=20 TIMED_WAIT 
| group="main" sCount=1 dsCount=0 obj=0x42af1508 self=0x5bca8708 
| sysTid=5096 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1540493584 
| schedstat=(119934078 250213626 359) utm=9 stm=2 core=0 
at java.lang.Object.wait(Native Method) 
- waiting on <0x42af1508> (a java.util.Timer$TimerImpl) 
at java.lang.Object.wait(Object.java:401) 
at java.util.Timer$TimerImpl.run(Timer.java:238) 

"Timer-0" prio=5 tid=19 TIMED_WAIT 
| group="main" sCount=1 dsCount=0 obj=0x42aff6e0 self=0x5bd20628 
| sysTid=5095 nice=0 sched=0/0 cgrp=[no-cpu-subsys] handle=1540493520 
| schedstat=(147308362 235565175 342) utm=14 stm=0 core=0 
at java.lang.Object.wait(Native Method) 
- waiting on <0x42aff6e0> (a java.util.Timer$TimerImpl) 
at java.lang.Object.wait(Object.java:401) 
at java.util.Timer$TimerImpl.run(Timer.java:238) 

从我分析了很多这些痕迹都是在类似的形式,如后“AudioTrack”线程,总会有一个“的AsyncTask#3”,这是第一个线程等待。

感谢您的帮助。

+0

你解决了你的问题吗? – 2014-10-04 09:54:48

+0

不幸的是没有。我发布在Adobe bugbase上,但他们回应说这个错误不是与AIR相关的。 – berkayk 2014-10-05 10:21:48

回答

0

尝试并循环播放第0卷上的背景音,这对我来说很合适。在我的情况下,它阻止了音频通道关闭,从而线程从未锁定。

+0

感谢您的回答,我会尝试一下并发布我的结果。 – berkayk 2014-10-11 08:50:48