代码之家  ›  专栏  ›  技术社区  ›  Stephen M -on strike-

Android ART Crash试图抛出ArrayOutOfBoundsException

  •  3
  • Stephen M -on strike-  · 技术社区  · 6 年前

    我们不时看到Android的艺术代码崩溃。我们在不进行边界检查的情况下索引到int数组,然后捕获Java的ArrayIndexOutOfBoundsException并正确处理它。

    我们的一些源代码:

    class IdToIndexData {
       private final int tmap[]; // Contents are set elsewhere
    
        int getTraitsIndexUnchecked(int id) {
            return tmap[id];
        }
    }
    
    class DataObjectInfo {
       public Integer getFieldTraits(Class1 map, int id) {
                int traitsIndex=map.getTraitsIndexUnchecked(id);
                return traitsIndex;
            } catch (ArrayIndexOutOfBoundsException e) {
                return null;
            }
        }
    }
    

    我无法创建一个简单的测试用例,因为我预期Android艺术库中会出现某种多线程竞争情况。

    “I/ObjectDBSet:changesComplete”来自不同的线程(请参阅“Message Processor”线程),但可能会触及调用getFieldTraits()的对象之一。int tmp[]是最终的,因此不会更改。此外,不会替换或更改DataObjectInfo和IdToIndexData对象。

    不管怎样,另一个线程都不应该导致Android艺术库崩溃。

    Android版本/设备:

    三星Galaxy Tab A,Android 7.0版本号NRD90M.T580UEU2BQL1。

    来自Android Studio:

    Android Gradle插件:3.1.4 等级:4.4 NDK:from local.properties:(未指定);SDK最新版本:(未找到); LLDB:未找到固定版本3.1;来自SDK的最新版本:(未找到包); CMake:来自local.properties:(未指定);SDK最新版本:(未找到);起始路径:(未找到);

    碰撞的全部输出:

    A/art: art/runtime/stack.cc:205] Check failed: success Failed to read the this object in int com.hcs.orc.datatype.IdToIndexData.getTraitsIndexUnchecked(int)
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    I/ObjectDBSet: changesComplete
    A/art: art/runtime/runtime.cc:419] Runtime aborting...
           art/runtime/runtime.cc:419] Aborting thread:
           art/runtime/runtime.cc:419] "main" prio=5 tid=1 Runnable
           art/runtime/runtime.cc:419]   | group="" sCount=0 dsCount=0 obj=0x7546a770 self=0xe4a85400
           art/runtime/runtime.cc:419]   | sysTid=10759 nice=0 cgrp=default sched=0/0 handle=0xe7cf0534
           art/runtime/runtime.cc:419]   | state=R schedstat=( 0 0 0 ) utm=1113 stm=15 core=1 HZ=100
           art/runtime/runtime.cc:419]   | stack=0xff5be000-0xff5c0000 stackSize=8MB
           art/runtime/runtime.cc:419]   | held mutexes= "abort lock" "mutator lock"(shared held)
           art/runtime/runtime.cc:419]   native: #00 pc 00351ce9  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
           art/runtime/runtime.cc:419]   native: #01 pc 00332205  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
    A/art: art/runtime/runtime.cc:419]   native: #02 pc 003251b1  /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+24)
           art/runtime/runtime.cc:419]   native: #03 pc 00324ffb  /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+362)
           art/runtime/runtime.cc:419]   native: #04 pc 0031bdc7  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+90)
           art/runtime/runtime.cc:419]   native: #05 pc 000b4dcb  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+866)
           art/runtime/runtime.cc:419]   native: #06 pc 00328df5  /system/lib/libart.so (_ZNK3art12StackVisitor13GetThisObjectEv+488)
           art/runtime/runtime.cc:419]   native: #07 pc 00125457  /system/lib/libart.so (_ZN3art19CatchLocationFinder10VisitFrameEv+50)
           art/runtime/runtime.cc:419]   native: #08 pc 00329d71  /system/lib/libart.so (_ZN3art12StackVisitor9WalkStackEb+440)
           art/runtime/runtime.cc:419]   native: #09 pc 0011b18d  /system/lib/libart.so (_ZN3art3Dbg13PostExceptionEPNS_6mirror9ThrowableE+108)
           art/runtime/runtime.cc:419]   native: #10 pc 001c0bb1  /system/lib/libart.so (_ZNK3art15instrumentation15Instrumentation20ExceptionCaughtEventEPNS_6ThreadEPNS_6mirror9ThrowableE+48)
           art/runtime/runtime.cc:419]   native: #11 pc 0033944d  /system/lib/libart.so (_ZN3art6Thread21QuickDeliverExceptionEv+504)
           art/runtime/runtime.cc:419]   native: #12 pc 003f67f9  /system/lib/libart.so (artThrowArrayBoundsFromCode+10)
           art/runtime/runtime.cc:419]   native: #13 pc 0002bab7  /dev/ashmem/dalvik-jit-code-cache_10759_10759 (deleted) (Java_com_hcs_orc_datatype_IdToIndexData_getTraitsIndexUnchecked__I+38)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.IdToIndexData.getTraitsIndexUnchecked(IdToIndexData.java:81)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.DataObjectInfo.getFieldTraits(DataObjectInfo.java:202)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.DataObjectBase.getTraits(DataObjectBase.java:114)
           art/runtime/runtime.cc:419]   at com.hcs.orc.table.config.OutputProfileBase.formatLine(OutputProfileBase.java:141)
           art/runtime/runtime.cc:419]   at com.hcs.android.orpanel.fragments.FutureProcedureFragment.lambda$updateView$0$FutureProcedureFragment(FutureProcedureFragment.java:174)
           art/runtime/runtime.cc:419]   at com.hcs.android.orpanel.fragments.FutureProcedureFragment$$Lambda$0.run(unavailable:-1)
           art/runtime/runtime.cc:419]   at android.os.Handler.handleCallback(Handler.java:751)
           art/runtime/runtime.cc:419]   at android.os.Handler.dispatchMessage(Handler.java:95)
           art/runtime/runtime.cc:419]   at android.os.Looper.loop(Looper.java:154)
           art/runtime/runtime.cc:419]   at android.app.ActivityThread.main(ActivityThread.java:6776)
           art/runtime/runtime.cc:419]   at java.lang.reflect.Method.invoke!(Native method)
           art/runtime/runtime.cc:419]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
           art/runtime/runtime.cc:419]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
           art/runtime/runtime.cc:419] Dumping all threads without appropriate locks held: thread list lock
           art/runtime/runtime.cc:419] All threads:
           art/runtime/runtime.cc:419] DALVIK THREADS (29):
           art/runtime/runtime.cc:419] "main" prio=5 tid=1 Runnable
           art/runtime/runtime.cc:419]   | group="" sCount=0 dsCount=0 obj=0x7546a770 self=0xe4a85400
           art/runtime/runtime.cc:419]   | sysTid=10759 nice=0 cgrp=default sched=0/0 handle=0xe7cf0534
           art/runtime/runtime.cc:419]   | state=R schedstat=( 0 0 0 ) utm=1115 stm=17 core=3 HZ=100
           art/runtime/runtime.cc:419]   | stack=0xff5be000-0xff5c0000 stackSize=8MB
           art/runtime/runtime.cc:419]   | held mutexes= "abort lock" "mutator lock"(shared held)
           art/runtime/runtime.cc:419]   native: #00 pc 00351ce9  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
           art/runtime/runtime.cc:419]   native: #01 pc 00332205  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
           art/runtime/runtime.cc:419]   native: #02 pc 00344357  /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+622)
           art/runtime/runtime.cc:419]   native: #03 pc 0033e0e1  /system/lib/libart.so (_ZN3art10ThreadList13RunCheckpointEPNS_7ClosureE+336)
           art/runtime/runtime.cc:419]   native: #04 pc 0033de01  /system/lib/libart.so (_ZN3art10ThreadList4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEb+180)
           art/runtime/runtime.cc:419]   native: #05 pc 00325005  /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+372)
           art/runtime/runtime.cc:419]   native: #06 pc 0031bdc7  /system/lib/libart.so (_ZN3art7Runtime5AbortEv+90)
           art/runtime/runtime.cc:419]   native: #07 pc 000b4dcb  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+866)
           art/runtime/runtime.cc:419]   native: #08 pc 00328df5  /system/lib/libart.so (_ZNK3art12StackVisitor13GetThisObjectEv+488)
           art/runtime/runtime.cc:419]   native: #09 pc 00125457  /system/lib/libart.so (_ZN3art19CatchLocationFinder10VisitFrameEv+50)
           art/runtime/runtime.cc:419]   native: #10 pc 00329d71  /system/lib/libart.so (_ZN3art12StackVisitor9WalkStackEb+440)
           art/runtime/runtime.cc:419]   native: #11 pc 0011b18d  /system/lib/libart.so (_ZN3art3Dbg13PostExceptionEPNS_6mirror9ThrowableE+108)
           art/runtime/runtime.cc:419]   native: #12 pc 001c0bb1  /system/lib/libart.so (_ZNK3art15instrumentation15Instrumentation20ExceptionCaughtEventEPNS_6ThreadEPNS_6mirror9ThrowableE+48)
           art/runtime/runtime.cc:419]   native: #13 pc 0033944d  /system/lib/libart.so (_ZN3art6Thread21QuickDeliverExceptionEv+504)
           art/runtime/runtime.cc:419]   native: #14 pc 003f67f9  /system/lib/libart.so (artThrowArrayBoundsFromCode+10)
           art/runtime/runtime.cc:419]   native: #15 pc 0002bab7  /dev/ashmem/dalvik-jit-code-cache_10759_10759 (deleted) (Java_com_hcs_orc_datatype_IdToIndexData_getTraitsIndexUnchecked__I+38)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.IdToIndexData.getTraitsIndexUnchecked(IdToIndexData.java:81)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.DataObjectInfo.getFieldTraits(DataObjectInfo.java:202)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.DataObjectBase.getTraits(DataObjectBase.java:114)
           art/runtime/runtime.cc:419]   at com.hcs.orc.table.config.OutputProfileBase.formatLine(OutputProfileBase.java:141)
           art/runtime/runtime.cc:419]   at com.hcs.android.orpanel.fragments.FutureProcedureFragment.lambda$updateView$0$FutureProcedureFragment(FutureProcedureFragment.java:174)
           art/runtime/runtime.cc:419]   at com.hcs.android.orpanel.fragments.FutureProcedureFragment$$Lambda$0.run(unavailable:-1)
           art/runtime/runtime.cc:419]   at android.os.Handler.handleCallback(Handler.java:751)
           art/runtime/runtime.cc:419]   at android.os.Handler.dispatchMessage(Handler.java:95)
           art/runtime/runtime.cc:419]   at android.os.Looper.loop(Looper.java:154)
           art/runtime/runtime.cc:419]   at android.app.ActivityThread.main(ActivityThread.java:6776)
           art/runtime/runtime.cc:419]   at java.lang.reflect.Method.invoke!(Native method)
           art/runtime/runtime.cc:419]   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1496)
           art/runtime/runtime.cc:419]   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1386)
           art/runtime/runtime.cc:419] 
           art/runtime/runtime.cc:419] "Jit thread pool worker thread 0" prio=5 tid=2 Runnable (still starting up)
           art/runtime/runtime.cc:419]   | group="" sCount=0 dsCount=0 obj=0x0 self=0xdb843000
           art/runtime/runtime.cc:419]   | sysTid=10764 nice=9 cgrp=default sched=0/0 handle=0xe41a7920
           art/runtime/runtime.cc:419]   | state=R schedstat=( 0 0 0 ) utm=225 stm=25 core=0 HZ=100
           art/runtime/runtime.cc:419]   | stack=0xe40a9000-0xe40ab000 stackSize=1022KB
           art/runtime/runtime.cc:419]   | held mutexes= "mutator lock"(shared held)
           art/runtime/runtime.cc:419]   native: #00 pc 00351ce9  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
           art/runtime/runtime.cc:419]   native: #01 pc 00332205  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
           art/runtime/runtime.cc:419]   native: #02 pc 00344357  /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+622)
           art/runtime/runtime.cc:419]   native: #03 pc 00332d95  /system/lib/libart.so (_ZN3art6Thread21RunCheckpointFunctionEv+144)
           art/runtime/runtime.cc:419]   native: #04 pc 000f042d  /system/lib/libart-compiler.so (???)
           art/runtime/runtime.cc:419]   native: #05 pc 00136655  /system/lib/libart-compiler.so (_ZN3art19HInstructionBuilder22BuildStaticFieldAccessERKNS_11InstructionEjb+2608)
           art/runtime/runtime.cc:419]   native: #06 pc 0012e5dd  /system/lib/libart-compiler.so (_ZN3art19HInstructionBuilder21ProcessDexInstructionERKNS_11InstructionEj+580)
           art/runtime/runtime.cc:419]   native: #07 pc 0012de5d  /system/lib/libart-compiler.so (_ZN3art19HInstructionBuilder5BuildEv+1176)
           art/runtime/runtime.cc:419]   native: #08 pc 00112c9d  /system/lib/libart-compiler.so (_ZN3art13HGraphBuilder10BuildGraphEv+84)
           art/runtime/runtime.cc:419]   native: #09 pc 0015720b  /system/lib/libart-compiler.so (_ZNK3art18OptimizingCompiler10TryCompileEPNS_14ArenaAllocatorEPNS_19CodeVectorAllocatorEPKNS_7DexFile8CodeItemEjNS_10InvokeTypeEtjP8_jobjectRKS5_NS_6HandleINS_6mirror8DexCacheEEEPNS_9ArtMethodEb+2454)
           art/runtime/runtime.cc:419]   native: #10 pc 00158e47  /system/lib/libart-compiler.so (_ZN3art18OptimizingCompiler10JitCompileEPNS_6ThreadEPNS_3jit12JitCodeCacheEPNS_9ArtMethodEb+330)
           art/runtime/runtime.cc:419]   native: #11 pc 00107f1f  /system/lib/libart-compiler.so (_ZN3art3jit11JitCompiler13CompileMethodEPNS_6ThreadEPNS_9ArtMethodEb+194)
           art/runtime/runtime.cc:419]   native: #12 pc 002506a3  /system/lib/libart.so (_ZN3art3jit3Jit13CompileMethodEPNS_9ArtMethodEPNS_6ThreadEb+318)
           art/runtime/runtime.cc:419]   native: #13 pc 00251dc7  /system/lib/libart.so (_ZN3art3jit14JitCompileTask3RunEPNS_6ThreadE+430)
           art/runtime/runtime.cc:419]   native: #14 pc 003450c9  /system/lib/libart.so (_ZN3art16ThreadPoolWorker3RunEv+44)
           art/runtime/runtime.cc:419]   native: #15 pc 00344c01  /system/lib/libart.so (_ZN3art16ThreadPoolWorker8CallbackEPv+64)
           art/runtime/runtime.cc:419]   native: #16 pc 00047f93  /system/lib/libc.so (_ZL15__pthread_startPv+22)
           art/runtime/runtime.cc:419]   native: #17 pc 0001a161  /system/lib/libc.so (__start_thread+6)
           art/runtime/runtime.cc:419]   (no managed stack frames)
           art/runtime/runtime.cc:419] 
           art/runtime/runtime.cc:419] "Signal Catcher" prio=5 tid=3 WaitingInMainSignalCatcherLoop
           art/runtime/runtime.cc:419]   | group="" sCount=1 dsCount=0 obj=0x12c44670 self=0xd9b98900
           art/runtime/runtime.cc:419]   | sysTid=10765 nice=0 cgrp=default sched=0/0 handle=0xe40a6920
           art/runtime/runtime.cc:419]   | state=S schedstat=( 0 0 0 ) utm=0 stm=0 core=1 HZ=100
    A/art: art/runtime/runtime.cc:419]   | stack=0xe3faa000-0xe3fac000 stackSize=1014KB
           art/runtime/runtime.cc:419]   | held mutexes=
           art/runtime/runtime.cc:419]   kernel: __switch_to+0x80/0x8c
           art/runtime/runtime.cc:419]   kernel: do_sigtimedwait+0xdc/0x1bc
           art/runtime/runtime.cc:419]   kernel: compat_SyS_rt_sigtimedwait+0x98/0xd8
           art/runtime/runtime.cc:419]   kernel: __sys_trace+0x48/0x4c
           art/runtime/runtime.cc:419]   native: #00 pc 00049780  /system/lib/libc.so (__rt_sigtimedwait+12)
           art/runtime/runtime.cc:419]   native: #01 pc 0001e933  /system/lib/libc.so (sigwait+34)
           art/runtime/runtime.cc:419]   native: #02 pc 003282df  /system/lib/libart.so (_ZN3art9SignalSet4WaitEv+22)
           art/runtime/runtime.cc:419]   native: #03 pc 00327ed9  /system/lib/libart.so (_ZN3art13SignalCatcher13WaitForSignalEPNS_6ThreadERNS_9SignalSetE+168)
           art/runtime/runtime.cc:419]   native: #04 pc 00326b1b  /system/lib/libart.so (_ZN3art13SignalCatcher3RunEPv+302)
           art/runtime/runtime.cc:419]   native: #05 pc 00047f93  /system/lib/libc.so (_ZL15__pthread_startPv+22)
           art/runtime/runtime.cc:419]   native: #06 pc 0001a161  /system/lib/libc.so (__start_thread+6)
           art/runtime/runtime.cc:419]   (no managed stack frames)
           art/runtime/runtime.cc:419] 
           art/runtime/runtime.cc:419] "JDWP" prio=5 tid=4 WaitingInMainDebuggerLoop
           art/runtime/runtime.cc:419]   | group="" sCount=1 dsCount=0 obj=0x12c445e0 self=0xdb844400
           art/runtime/runtime.cc:419]   | sysTid=10766 nice=0 cgrp=default sched=0/0 handle=0xe3fa7920
           art/runtime/runtime.cc:419]   | state=S schedstat=( 0 0 0 ) utm=44 stm=15 core=0 HZ=100
           art/runtime/runtime.cc:419]   | stack=0xe3eab000-0xe3ead000 stackSize=1014KB
           art/runtime/runtime.cc:419]   | held mutexes=
           art/runtime/runtime.cc:419]   kernel: __switch_to+0x80/0x8c
           art/runtime/runtime.cc:419]   kernel: poll_schedule_timeout+0x40/0x68
           art/runtime/runtime.cc:419]   kernel: do_select+0x4bc/0x500
           art/runtime/runtime.cc:419]   kernel: compat_core_sys_select+0x158/0x20c
           art/runtime/runtime.cc:419]   kernel: compat_SyS_pselect6+0x174/0x210
           art/runtime/runtime.cc:419]   kernel: __sys_trace+0x48/0x4c
           art/runtime/runtime.cc:419]   native: #00 pc 00049658  /system/lib/libc.so (__pselect6+20)
           art/runtime/runtime.cc:419]   native: #01 pc 0001d539  /system/lib/libc.so (select+88)
           art/runtime/runtime.cc:419]   native: #02 pc 003fe093  /system/lib/libart.so (_ZN3art4JDWP12JdwpAdbState15ProcessIncomingEv+302)
           art/runtime/runtime.cc:419]   native: #03 pc 002497ef  /system/lib/libart.so (_ZN3art4JDWP9JdwpState3RunEv+654)
           art/runtime/runtime.cc:419]   native: #04 pc 00248f8f  /system/lib/libart.so (_ZN3art4JDWPL15StartJdwpThreadEPv+22)
           art/runtime/runtime.cc:419]   native: #05 pc 00047f93  /system/lib/libc.so (_ZL15__pthread_startPv+22)
           art/runtime/runtime.cc:419]   native: #06 pc 0001a161  /system/lib/libc.so (__start_thread+6)
           art/runtime/runtime.cc:419]   (no managed stack frames)
           art/runtime/runtime.cc:419] 
           art/runtime/runtime.cc:419] "MessageProcessor" prio=5 tid=17 Runnable
           art/runtime/runtime.cc:419]   | group="" sCount=0 dsCount=0 obj=0x12ce11a0 self=0xde362d00
           art/runtime/runtime.cc:419]   | sysTid=11066 nice=0 cgrp=default sched=0/0 handle=0xc561e920
           art/runtime/runtime.cc:419]   | state=R schedstat=( 0 0 0 ) utm=388 stm=5 core=2 HZ=100
           art/runtime/runtime.cc:419]   | stack=0xc551c000-0xc551e000 stackSize=1038KB
           art/runtime/runtime.cc:419]   | held mutexes= "mutator lock"(shared held)
           art/runtime/runtime.cc:419]   native: #00 pc 00351ce9  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
           art/runtime/runtime.cc:419]   native: #01 pc 00332205  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
           art/runtime/runtime.cc:419]   native: #02 pc 00344357  /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6ThreadE+622)
           art/runtime/runtime.cc:419]   native: #03 pc 00332d95  /system/lib/libart.so (_ZN3art6Thread21RunCheckpointFunctionEv+144)
           art/runtime/runtime.cc:419]   native: #04 pc 0020dea3  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+51530)
           art/runtime/runtime.cc:419]   native: #05 pc 001cbded  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+368)
           art/runtime/runtime.cc:419]   native: #06 pc 001d084f  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
           art/runtime/runtime.cc:419]   native: #07 pc 001e7f67  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+450)
           art/runtime/runtime.cc:419]   native: #08 pc 001fff3d  /system/lib/libart.so (_ZN3art11interpreterL20DoInvokeVirtualQuickILb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+304)
           art/runtime/runtime.cc:419]   native: #09 pc 002055db  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+16514)
           art/runtime/runtime.cc:419]   native: #10 pc 001cbded  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+368)
           art/runtime/runtime.cc:419]   native: #11 pc 001d084f  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
           art/runtime/runtime.cc:419]   native: #12 pc 001e7f67  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+450)
           art/runtime/runtime.cc:419]   native: #13 pc 001fff3d  /system/lib/libart.so (_ZN3art11interpreterL20DoInvokeVirtualQuickILb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+304)
           art/runtime/runtime.cc:419]   native: #14 pc 002055db  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+16514)
           art/runtime/runtime.cc:419]   native: #15 pc 001cbded  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+368)
           art/runtime/runtime.cc:419]   native: #16 pc 001d084f  /system/lib/libart.so (_ZN3art11interpreter33ArtInterpreterToInterpreterBridgeEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameEPNS_6JValueE+114)
           art/runtime/runtime.cc:419]   native: #17 pc 001e7f67  /system/lib/libart.so (_ZN3art11interpreter6DoCallILb0ELb0EEEbPNS_9ArtMethodEPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+450)
           art/runtime/runtime.cc:419]   native: #18 pc 001fff3d  /system/lib/libart.so (_ZN3art11interpreterL20DoInvokeVirtualQuickILb0EEEbPNS_6ThreadERNS_11ShadowFrameEPKNS_11InstructionEtPNS_6JValueE+304)
           art/runtime/runtime.cc:419]   native: #19 pc 002055db  /system/lib/libart.so (_ZN3art11interpreter17ExecuteSwitchImplILb0ELb0EEENS_6JValueEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameES2_b+16514)
           art/runtime/runtime.cc:419]   native: #20 pc 001cbded  /system/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadEPKNS_7DexFile8CodeItemERNS_11ShadowFrameENS_6JValueEb+368)
           art/runtime/runtime.cc:419]   native: #21 pc 001d07b9  /system/lib/libart.so (_ZN3art11interpreter30EnterInterpreterFromEntryPointEPNS_6ThreadEPKNS_7DexFile8CodeItemEPNS_11ShadowFrameE+92)
           art/runtime/runtime.cc:419]   native: #22 pc 003f6dbd  /system/lib/libart.so (artQuickToInterpreterBridge+716)
           art/runtime/runtime.cc:419]   native: #23 pc 000add93  /system/lib/libart.so (art_quick_to_interpreter_bridge+34)
           art/runtime/runtime.cc:419]   native: #24 pc 0001b4b1  /dev/ashmem/dalvik-jit-code-cache_10759_10759 (deleted) (???)
           art/runtime/runtime.cc:419]   at java.lang.Boolean.booleanValue(Boolean.java:132)
           art/runtime/runtime.cc:419]   at com.hcs.orc.data.Parameter.isFeatureSchedulingEnabled(Parameter.java:1349)
           art/runtime/runtime.cc:419]   at com.hcs.orc.datatype.logic.ProcedureLogic.isAppointmentRequest(ProcedureLogic.java:439)
           art/runtime/runtime.cc:419]   at com.hcs.android.orc.service.datatype.Procedure.isAppointmentRequest(Procedure.java:260)
           art/runtime/runtime.cc:419]   at com.hcs.orc.data.odb.ProcedureComparator.compare(ProcedureComparator.java:83)
           art/runtime/runtime.cc:419]   at com.hcs.orc.data.odb.ProcedureComparator.compare(ProcedureComparator.java:32)
           art/runtime/runtime.cc:419]   at java.util.TimSort.countRunAndMakeAscending(TimSort.java:360)
           art/runtime/runtime.cc:419]   at java.util.TimSort.sort(TimSort.java:220)
           art/runtime/runtime.cc:419]   at java.util.Arrays.sort(Arrays.java:1450)
           art/runtime/runtime.cc:419]   at java.util.Collections.sort(Collections.java:243)
           art/runtime/runtime.cc:419]   at com.hcs.orc.data.IndexedVector.sort(IndexedVector.java:216)
           art/runtime/runtime.cc:419]   at com.hcs.orc.data.odb.ProcedureDBLogic.sort(ProcedureDBLogic.java:61)
           art/runtime/runtime.cc:419]   at com.hcs.android.orc.service.datatype.Procedure$DB.sort(Procedure.java:583)
           art/runtime/runtime.cc:419]   at com.hcs.android.orc.service.data.ObjectDBSet.publishChangesComplete(ObjectDBSet.java:212)
           art/runtime/runtime.cc:419]   - locked <0x08c86602> (a com.hcs.android.orc.service.data.ObjectDBSet)
           art/runtime/runtime.cc:419]   at com.hcs.android.orc.service.message.DataMessageHandler.handle(DataMessageHandler.java:77)
           art/runtime/runtime.cc:419]   at com.hcs.android.orc.service.message.MessageProcessor.processMessage(MessageProcessor.java:119)
           art/runtime/runtime.cc:419]   at com.hcs.android.orc.service.message.MessageProcessor.work(MessageProcessor.java:95)
           art/runtime/runtime.cc:419]   at com.hcs.util.OAThread.run(OAThread.java:45)
           art/runtime/runtime.cc:419] 
           art/runtime/runtime.cc:419] "Thread-8" prio=5 tid=25 Native
           art/runtime/runtime.cc:419]   | group="" sCount=1 dsCount=0 obj=0x12fa7d30 self=0xde363700
           art/runtime/runtime.cc:419]   | sysTid=11075 nice=0 cgrp=default sched=0/0 handle=0xc3d71920
           art/runtime/runtime.cc:419]   | state=S schedstat=( 0 0 0 ) utm=4210 stm=328 core=0 HZ=100
           art/runtime/runtime.cc:419]   | stack=0xc3c6f000-0xc3c71000 stackSize=1038KB
           art/runtime/runtime.cc:419]   | held mutexes=
           art/runtime/runtime.cc:419]   kernel: __switch_to+0x80/0x8c
           art/runtime/runtime.cc:419]   kernel: futex_wait_queue_me+0xe0/0x144
           art/runtime/runtime.cc:419]   kernel: futex_wait+0xe8/0x1d8
           art/runtime/runtime.cc:419]   kernel: do_futex+0xc8/0x860
           art/runtime/runtime.cc:419]   kernel: compat_SyS_futex+0xc8/0x144
           art/runtime/runtime.cc:419]   kernel: __sys_trace+0x48/0x4c
           art/runtime/runtime.cc:419]   native: #00 pc 00017530  /system/lib/libc.so (syscall+28)
           art/runtime/runtime.cc:419]   native: #01 pc 00076bbf  /system/lib/libmedia.so (_ZN7android11ClientProxy12obtainBufferEPNS_5Proxy6BufferEPK8timespecPS4_+554)
           art/runtime/runtime.cc:419]   native: #02 pc 000870d7  /system/lib/libmedia.so (_ZN7android11AudioRecord12obtainBufferEPNS0_6BufferEPK8timespecPS3_Pj+202)
           art/runtime/runtime.cc:419]   native: #03 pc 0008728b  /system/lib/libmedia.so (_ZN7android11AudioRecord4readEPvjb+150)
           art/runtime/runtime.cc:419]   native: #04 pc 000b08df  /system/lib/libandroid_runtime.so (???)
           art/runtime/runtime.cc:419]   native: #05 pc 004cf95f  /system/framework/arm/boot-framework.oat (Java_android_media_AudioRecord_native_1read_1in_1short_1array___3SIIZ+122)
           art/runtime/runtime.cc:419]   at android.media.AudioRecord.native_read_in_short_array(Native method)
           art/runtime/runtime.cc:419]   at android.media.AudioRecord.read(AudioRecord.java:1243)
           art/runtime/runtime.cc:419]   at android.media.AudioRecord.read(AudioRecord.java:1197)
           art/runtime/runtime.cc:419]   at edu.cmu.pocketsphinx.SpeechRecognizer$RecognizerThread.run(SpeechRecognizer.java:344)
           art/runtime/runtime.cc:419]
    
    A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 10759 (android.orpanel)
    

    注意:删除了一些线程,这些线程只是等待在StackOverFlow上低于30000字符的限制。

    更新1

    我的问题是

    相反,我正在寻找一个解释,说明我的代码是如何导致这个问题的(即,它确实是我的bug),或者它是否是一个已知的Android bug。

    1 回复  |  直到 6 年前
        1
  •  1
  •   Stephen M -on strike-    6 年前

    https://issuetracker.google.com/issues/116246633

    使用边界检查作为解决方法,而不是依赖Android正确抛出ArrayIndexOutOfBoundsException。