由MediaCodec.dequeInputBuffer引起的令人讨厌的ANR

时间:2014-05-02 23:03:33

标签: android mediacodec

我亲眼目睹并收到了我的应用程序中罕见但特别令人讨厌的ANR的报告,导致该应用程序完全无用,除非它已卸载并重新安装,甚至没有强制停止应用程序(应该关闭整个过程)可以从ANR中获取应用程序。

我无法从ANR报告中得到任何结果,但这个报告有一些有用的信息。看来MediaCodec.dequeueInputBuffer没有返回。它的超时时间为200000微秒。这发生在主线程的同步代码块中,其中涉及MediaCodec和MediaExtractor对象的所有操作都发生在该代码块中。主线程正在等待锁进入包含对MediaExtractor.seekTo()的调用的代码块。

SoundTouchPlayable和MediaCodecAudioDecoder的整个代码可以在https://github.com/svenoaks/SoundTouch-Android/tree/master/src/com/smp/soundtouchandroid找到 非主线程中的锁定发生在MediaCodecAudioDecoder第181行。

我不确定我能做些什么,如果有的话。我该怎么办?

----- pid 21484 at 2014-05-01 12:50:08 -----
Cmd line: com.smp.musicspeed

JNI: CheckJNI is off; workarounds are off; pins=0; globals=336 (plus 35 weak)

DALVIK THREADS:
(mutexes: tll=0 tsl=0 tscl=0 ghl=0)

"main" prio=5 tid=1 MONITOR
| group="main" sCount=1 dsCount=0 obj=0x41656e40 self=0x41645450
| sysTid=21484 nice=-6 sched=0/0 cgrp=apps handle=1074180436
| state=S schedstat=( 0 0 0 ) utm=936 stm=126 core=0
at com.smp.soundtouchandroid.SoundTouchPlayable.seekTo(SoundTouchPlayable.java:~292)
- waiting to lock <0x422cfb18> (a java.lang.Object) held by tid=20 (Thread-157041)
at com.smp.musicspeed.SoundTouchPlayService.seekTo(SoundTouchPlayService.java:376)
at com.smp.musicspeed.MainActivity$1$1$1.run(MainActivity.java:134)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5184)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1015)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:831)
at dalvik.system.NativeStart.main(Native Method)

"Visualizer" prio=5 tid=26 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x4231ac08 self=0x6a4f1298
| sysTid=21802 nice=0 sched=0/0 cgrp=apps handle=1853423672
| state=S schedstat=( 0 0 0 ) utm=11 stm=2 core=0
#00 pc 0002114c /system/lib/libc.so (nanosleep+12)
#01 pc 0002fc17 /system/lib/libc.so (usleep+30)
#02 pc 00069fd7 /system/lib/libmedia.so (android::Visualizer::CaptureThread::threadLoop()+8)
#03 pc 0000f149 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#04 pc 00050357 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+98)
#05 pc 0000ec0f /system/lib/libutils.so
#06 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#07 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"Thread-157041" prio=10 tid=20 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x4231dd00 self=0x6c2c0278
| sysTid=21801 nice=-8 sched=0/0 cgrp=apps handle=1825959168
| state=S schedstat=( 0 0 0 ) utm=6 stm=0 core=0
#00 pc 00021dc4 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 000098d7 /system/lib/libstagefright_foundation.so (android::ALooperRoster::postAndAwaitResponse(android::sp<android::AMessage> const&, android::sp<android::AMessage>*)+78)
#04 pc 0000a4e7 /system/lib/libstagefright_foundation.so (android::AMessage::postAndAwaitResponse(android::sp<android::AMessage>*)+26)
#05 pc 000724a3 /system/lib/libstagefright.so (android::MediaCodec::PostAndAwaitResponse(android::sp<android::AMessage> const&, android::sp<android::AMessage>*)+6)
#06 pc 00072e17 /system/lib/libstagefright.so (android::MediaCodec::dequeueInputBuffer(unsigned int*, long long)+66)
#07 pc 0001442d /system/lib/libmedia_jni.so
#08 pc 0002044c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#09 pc 00054019 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+428)
#10 pc 000298e0 /system/lib/libdvm.so
#11 pc 00031840 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#12 pc 0002ed5c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+232)
#13 pc 000697c5 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#14 pc 000697e9 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#15 pc 0005cc7b /system/lib/libdvm.so
#16 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#17 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at android.media.MediaCodec.dequeueInputBuffer(Native Method)
at com.smp.soundtouchandroid.MediaCodecAudioDecoder.advanceInput(MediaCodecAudioDecoder.java:181)
at com.smp.soundtouchandroid.MediaCodecAudioDecoder.decodeChunk(MediaCodecAudioDecoder.java:125)
at com.smp.soundtouchandroid.SoundTouchPlayable.playFile(SoundTouchPlayable.java:373)
at com.smp.soundtouchandroid.SoundTouchPlayable.run(SoundTouchPlayable.java:228)
at java.lang.Thread.run(Thread.java:856)

"AudioTrack" prio=10 tid=19 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x4231dc40 self=0x6a699228
| sysTid=21800 nice=-16 sched=0/0 cgrp=apps handle=1785696352
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0
#00 pc 00021dc8 /system/lib/libc.so (__futex_syscall3+12)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 000482b5 /system/lib/libmedia.so (android::AudioTrack::AudioTrackThread::threadLoop()+116)
#03 pc 0000f0d9 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+104)
#04 pc 00050357 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+98)
#05 pc 0000ec0f /system/lib/libutils.so
#06 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#07 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"OMXCallbackDisp" prio=6 tid=18 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x422ca468 self=0x6ef90ef0
| sysTid=21799 nice=-2 sched=0/0 cgrp=apps handle=1851258128
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0
#00 pc 00021dc4 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 0000e719 /system/lib/libstagefright_omx.so (android::OMX::CallbackDispatcher::loop()+40)
#04 pc 0000f149 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#05 pc 00050357 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+98)
#06 pc 0000ec0f /system/lib/libutils.so
#07 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"ModernAsyncTask #2" prio=5 tid=25 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4244ea50 self=0x6671ffb0
| sysTid=21756 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1787397960
| state=S schedstat=( 0 0 0 ) utm=0 stm=1 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x42316088> (a java.lang.VMThread) held by tid=25 (ModernAsyncTask #2)
at java.lang.Thread.parkFor(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2017)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:856)

"JavaBridge" prio=5 tid=24 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41fb6ae8 self=0x6df54688
| sysTid=21744 nice=0 sched=0/0 cgrp=apps handle=1837055584
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3
#00 pc 00021a04 /system/lib/libc.so (epoll_wait+12)
#01 pc 00010e1f /system/lib/libutils.so (android::Looper::pollInner(int)+98)
#02 pc 000110c9 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#03 pc 0006e609 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#04 pc 0002044c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#05 pc 00054019 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+428)
#06 pc 000298e0 /system/lib/libdvm.so
#07 pc 00031840 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#08 pc 0002ed5c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+232)
#09 pc 000697c5 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#10 pc 000697e9 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#11 pc 0005cc7b /system/lib/libdvm.so
#12 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#13 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:148)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:61)

"PowerManagerThread" prio=5 tid=23 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42340140 self=0x6df63ef0
| sysTid=21742 nice=0 sched=0/0 cgrp=apps handle=1785189064
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3
#00 pc 00021a04 /system/lib/libc.so (epoll_wait+12)
#01 pc 00010e1f /system/lib/libutils.so (android::Looper::pollInner(int)+98)
#02 pc 000110c9 /system/lib/libutils.so (android::Looper::pollOnce(int, int*, int*, void**)+92)
#03 pc 0006e609 /system/lib/libandroid_runtime.so (android::NativeMessageQueue::pollOnce(_JNIEnv*, int)+22)
#04 pc 0002044c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#05 pc 00054019 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+428)
#06 pc 000298e0 /system/lib/libdvm.so
#07 pc 00031840 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#08 pc 0002ed5c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+232)
#09 pc 000697c5 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#10 pc 000697e9 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#11 pc 0005cc7b /system/lib/libdvm.so
#12 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#13 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at android.os.MessageQueue.nativePollOnce(Native Method)
at android.os.MessageQueue.next(MessageQueue.java:148)
at android.os.Looper.loop(Looper.java:123)
at android.os.HandlerThread.run(HandlerThread.java:61)

"ModernAsyncTask #1" prio=5 tid=22 WAIT
| group="main" sCount=1 dsCount=0 obj=0x42330dc8 self=0x6d7d36f0
| sysTid=21741 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1718732032
| state=S schedstat=( 0 0 0 ) utm=1 stm=0 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x4234d908> (a java.lang.VMThread) held by tid=22 (ModernAsyncTask #1)
at java.lang.Thread.parkFor(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.park(LockSupport.java:157)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2017)
at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:410)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:856)

"FileObserver" prio=5 tid=16 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42352798 self=0x6ef902b0
| sysTid=21740 nice=0 sched=0/0 cgrp=apps handle=1853392264
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0
#00 pc 00020590 /system/lib/libc.so (read+12)
#01 pc 0008ac23 /system/lib/libandroid_runtime.so
#02 pc 0002044c /system/lib/libdvm.so (dvmPlatformInvoke+112)
#03 pc 00054019 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+428)
#04 pc 000298e0 /system/lib/libdvm.so
#05 pc 00031840 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#06 pc 0002ed5c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+232)
#07 pc 000697c5 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#08 pc 000697e9 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20)
#09 pc 0005cc7b /system/lib/libdvm.so
#10 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#11 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at android.os.FileObserver$ObserverThread.observe(Native Method)
at android.os.FileObserver$ObserverThread.run(FileObserver.java:88)

"Thread-157029" prio=4 tid=21 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x424de938 self=0x6a9451e8
| sysTid=21666 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1786046376
| state=S schedstat=( 0 0 0 ) utm=1 stm=0 core=3
#00 pc 00021dc4 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00b4fd31 /system/lib/libwebviewchromium.so
#04 pc 001dbcdf /system/lib/libwebviewchromium.so
#05 pc 001dbf2b /system/lib/libwebviewchromium.so
#06 pc 001da16b /system/lib/libwebviewchromium.so
#07 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#08 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"OkHttp ConnectionPool" daemon prio=5 tid=17 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x42336c90 self=0x6a6f81d8
| sysTid=21533 nice=0 sched=0/0 cgrp=apps handle=1785691240
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x42336d68> (a java.lang.VMThread) held by tid=17 (OkHttp ConnectionPool)
at java.lang.Thread.parkFor(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2056)
at java.util.concurrent.LinkedBlockingQueue.poll(LinkedBlockingQueue.java:435)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:856)

"Thread-157021" prio=5 tid=15 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x422cfe58 self=0x6a8afb18
| sysTid=21516 nice=0 sched=0/0 cgrp=apps handle=1783564672
| state=S schedstat=( 0 0 0 ) utm=47 stm=6 core=0
#00 pc 00021dc8 /system/lib/libc.so (__futex_syscall3+12)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 001e52d7 /system/lib/libwebviewchromium.so
#04 pc 001d97cd /system/lib/libwebviewchromium.so
#05 pc 001cff3f /system/lib/libwebviewchromium.so
#06 pc 001cf485 /system/lib/libwebviewchromium.so
#07 pc 001d3f4f /system/lib/libwebviewchromium.so
#08 pc 001cecbf /system/lib/libwebviewchromium.so
#09 pc 001dc33d /system/lib/libwebviewchromium.so
#10 pc 001da16b /system/lib/libwebviewchromium.so
#11 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#12 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"AdWorker #2" prio=5 tid=14 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x422e3f48 self=0x6a6b8988
| sysTid=21513 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1784930528
| state=S schedstat=( 0 0 0 ) utm=6 stm=0 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x41fc9458> (a java.lang.VMThread) held by tid=14 (AdWorker #2)
at java.lang.Thread.parkFor(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197)
at java.util.concurrent.SynchronousQueue$TransferQueue.awaitFulfill(SynchronousQueue.java:733)
at java.util.concurrent.SynchronousQueue$TransferQueue.transfer(SynchronousQueue.java:664)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:910)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:856)

"AdWorker #1" prio=5 tid=13 TIMED_WAIT
| group="main" sCount=1 dsCount=0 obj=0x42335668 self=0x6c0cec20
| sysTid=21511 nice=10 sched=0/0 cgrp=apps/bg_non_interactive handle=1812787320
| state=S schedstat=( 0 0 0 ) utm=2 stm=0 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x42335808> (a java.lang.VMThread) held by tid=13 (AdWorker #1)
at java.lang.Thread.parkFor(Thread.java:1220)
at sun.misc.Unsafe.park(Unsafe.java:325)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:197)
at java.util.concurrent.SynchronousQueue$TransferQueue.awaitFulfill(SynchronousQueue.java:733)
at java.util.concurrent.SynchronousQueue$TransferQueue.transfer(SynchronousQueue.java:664)
at java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:910)
at java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1035)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1097)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:856)

"CleanupReference" daemon prio=5 tid=12 WAIT
| group="main" sCount=1 dsCount=0 obj=0x4232b618 self=0x6c2bf8e0
| sysTid=21510 nice=0 sched=0/0 cgrp=apps handle=1814822200
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x4232b550> (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 com.android.org.chromium.content.common.CleanupReference$1.run(CleanupReference.java:48)

"Thread-157017" prio=5 tid=11 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x423293a0 self=0x6c2b38e0
| sysTid=21499 nice=0 sched=0/0 cgrp=apps handle=1782253760
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2
#00 pc 00021dc4 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 001d97d5 /system/lib/libwebviewchromium.so
#04 pc 001d97f5 /system/lib/libwebviewchromium.so
#05 pc 001cff0f /system/lib/libwebviewchromium.so
#06 pc 001cf485 /system/lib/libwebviewchromium.so
#07 pc 001d3f4f /system/lib/libwebviewchromium.so
#08 pc 001cecbf /system/lib/libwebviewchromium.so
#09 pc 008e9893 /system/lib/libwebviewchromium.so
#10 pc 008e9c8b /system/lib/libwebviewchromium.so
#11 pc 001dc33d /system/lib/libwebviewchromium.so
#12 pc 001da16b /system/lib/libwebviewchromium.so
#13 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#14 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"Thread-157015" prio=5 tid=10 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x42325e00 self=0x6a42b578
| sysTid=21504 nice=-6 sched=0/0 cgrp=apps handle=1782737400
| state=S schedstat=( 0 0 0 ) utm=18 stm=10 core=0
#00 pc 00021a04 /system/lib/libc.so (epoll_wait+12)
#01 pc 001e7ff3 /system/lib/libwebviewchromium.so
#02 pc 001e71e5 /system/lib/libwebviewchromium.so
#03 pc 001e010f /system/lib/libwebviewchromium.so
#04 pc 001cf485 /system/lib/libwebviewchromium.so
#05 pc 001d3f4f /system/lib/libwebviewchromium.so
#06 pc 001cecbf /system/lib/libwebviewchromium.so
#07 pc 008e9901 /system/lib/libwebviewchromium.so
#08 pc 008e9cb3 /system/lib/libwebviewchromium.so
#09 pc 001dc33d /system/lib/libwebviewchromium.so
#10 pc 001da16b /system/lib/libwebviewchromium.so
#11 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#12 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"Binder_2" prio=5 tid=9 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41b878e8 self=0x6659d530
| sysTid=21495 nice=0 sched=0/0 cgrp=apps handle=1717162728
| state=S schedstat=( 0 0 0 ) utm=1 stm=0 core=0
#00 pc 00020850 /system/lib/libc.so (__ioctl+8)
#01 pc 0002d187 /system/lib/libc.so (ioctl+14)
#02 pc 0001d561 /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140)
#03 pc 0001dc6b /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6)
#04 pc 0001dd01 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
#05 pc 00022019 /system/lib/libbinder.so
#06 pc 0000f149 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#07 pc 00050357 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+98)
#08 pc 0000ec0f /system/lib/libutils.so
#09 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#10 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"Binder_1" prio=5 tid=8 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x41b87748 self=0x6659c8b0
| sysTid=21494 nice=0 sched=0/0 cgrp=apps handle=1717159528
| state=S schedstat=( 0 0 0 ) utm=1 stm=0 core=0
#00 pc 00020850 /system/lib/libc.so (__ioctl+8)
#01 pc 0002d187 /system/lib/libc.so (ioctl+14)
#02 pc 0001d561 /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140)
#03 pc 0001dc6b /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6)
#04 pc 0001dd01 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
#05 pc 00022019 /system/lib/libbinder.so
#06 pc 0000f149 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#07 pc 00050357 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+98)
#08 pc 0000ec0f /system/lib/libutils.so
#09 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#10 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"FinalizerWatchdogDaemon" daemon prio=5 tid=7 WAIT
| group="system" sCount=1 dsCount=0 obj=0x41b830e8 self=0x6659bbc8
| sysTid=21493 nice=0 sched=0/0 cgrp=apps handle=1717157920
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x41660478> (a java.lang.Daemons$FinalizerWatchdogDaemon)
at java.lang.Object.wait(Object.java:364)
at java.lang.Daemons$FinalizerWatchdogDaemon.waitForObject(Daemons.java:230)
at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:207)
at java.lang.Thread.run(Thread.java:856)

"FinalizerDaemon" daemon prio=5 tid=6 WAIT
| group="system" sCount=1 dsCount=0 obj=0x41b82f90 self=0x6659a768
| sysTid=21492 nice=0 sched=0/0 cgrp=apps handle=1717152704
| state=S schedstat=( 0 0 0 ) utm=1 stm=0 core=0
at java.lang.Object.wait(Native Method)
- waiting on <0x4164b7d8> (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:170)
at java.lang.Thread.run(Thread.java:856)

"ReferenceQueueDaemon" daemon prio=5 tid=5 WAIT
| group="system" sCount=1 dsCount=0 obj=0x41b82e28 self=0x66599ec0
| sysTid=21491 nice=0 sched=0/0 cgrp=apps handle=1717150488
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3
at java.lang.Object.wait(Native Method)
- waiting on <0x4164b700> 
at java.lang.Object.wait(Object.java:364)
at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:130)
at java.lang.Thread.run(Thread.java:856)

"Compiler" daemon prio=5 tid=4 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x41b82d38 self=0x415b4258
| sysTid=21490 nice=0 sched=0/0 cgrp=apps handle=1096499216
| state=S schedstat=( 0 0 0 ) utm=11 stm=9 core=0
#00 pc 00021dc4 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 00080937 /system/lib/libdvm.so
#04 pc 0005c0fd /system/lib/libdvm.so
#05 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#06 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

"Signal Catcher" daemon prio=5 tid=3 RUNNABLE
| group="system" sCount=0 dsCount=0 obj=0x41b82c40 self=0x648b9120
| sysTid=21489 nice=0 sched=0/0 cgrp=apps handle=1772267456
| state=R schedstat=( 0 0 0 ) utm=2 stm=2 core=3
at dalvik.system.NativeStart.run(Native Method)

"GC" daemon prio=5 tid=2 VMWAIT
| group="system" sCount=1 dsCount=0 obj=0x41b82b60 self=0x648bc070
| sysTid=21488 nice=0 sched=0/0 cgrp=apps handle=1686879040
| state=S schedstat=( 0 0 0 ) utm=2 stm=0 core=0
#00 pc 00021dc4 /system/lib/libc.so (__futex_syscall3+8)
#01 pc 0000ef54 /system/lib/libc.so (__pthread_cond_timedwait_relative+48)
#02 pc 0000efb4 /system/lib/libc.so (__pthread_cond_timedwait+64)
#03 pc 0007eff3 /system/lib/libdvm.so
#04 pc 0005c0fd /system/lib/libdvm.so
#05 pc 0000d200 /system/lib/libc.so (__thread_entry+72)
#06 pc 0000d398 /system/lib/libc.so (pthread_create+240)
at dalvik.system.NativeStart.run(Native Method)

NATIVE THREADS:
".smp.musicspeed" sysTid=21498 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2

".smp.musicspeed" sysTid=21500 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2

".smp.musicspeed" sysTid=21501 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2

".smp.musicspeed" sysTid=21502 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=2

".smp.musicspeed" sysTid=21503 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=0

".smp.musicspeed" sysTid=21505 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3

".smp.musicspeed" sysTid=21506 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3

".smp.musicspeed" sysTid=21507 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3

".smp.musicspeed" sysTid=21508 nice=0 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=3

".smp.musicspeed" sysTid=21517 nice=-6 sched=0/0 cgrp=apps
| state=S schedstat=( 0 0 0 ) utm=1 stm=1 core=0

1 个答案:

答案 0 :(得分:0)

编辑1:

ANR由以下任一条件触发。

  • 在5秒内没有响应输入事件(例如按键或屏幕触摸事件)。
  • BroadcastReceiver尚未在10秒内完成执行。

由于您的超时设置为亚秒值,因此它不太可能是您问题的直接来源。问题更可能是同步块的结果。如果由于线程同步而导致主线程上运行的代码被延迟,则可能很容易触发ANR条件之一。

如果没有其他人已经确定问题,我今晚稍后会看看你的实际代码。

编辑2:

查看问题和代码中的ANR转储,问题似乎是由decodeLock在尝试进行搜索时的锁定争用引起的。持有锁的线程是路径SoundTouchPlayable.run() - &gt; SoundTouchPlayable.playFile() - &gt; MediaCodecAudioDecoder.decodeChunk() - &gt; MediaCodecAudioDecoder.advanceInput()。

获取的本机线程。

为了达到这个目的,我在ANR转储中寻找“等待”。 Object.wait上的那些不是问题;他们只是在等待更多的消息。唯一不同的是waiting to lock <0x422cfb18> (a java.lang.Object) held by tid=20。然后,只需要查看哪些线程有tid=20

我建议确定这两个不同线程如何/为何同时运行。然后制定计划以防止它们这样做,或者如果它们可以同时运行,则更改同步锁以允许它。

要解决必须进行卸载才能恢复的问题,请考虑一个简单的强制停止可能会使某些进程继续运行。对于查找和终止在该用户ID下运行的所有进程(每个应用程序都有自己的进程),卸载将更加积极。