Android 是什么导致了这次事故?带“输出”;检查失败:threadId!=0u“;

Android 是什么导致了这次事故?带“输出”;检查失败:threadId!=0u“;,android,android-studio,debugging,kotlin,rx-java,Android,Android Studio,Debugging,Kotlin,Rx Java,当我的应用程序崩溃时,我在代码中随机得到下面的输出(与我能识别的任何操作无关)。有人能帮我解释一下logcat输出的含义吗 我截短了大部分文本,列出了各种线程及其状态(等待、定时等待、阻塞等),以及该线程上方法调用的堆栈跟踪 07-31 14:39:40.455 942-947/com.salesrabbit.android.sales.universal A/art: art/runtime/jdwp/jdwp_event.cc:681] Check failed: threadId != 0

当我的应用程序崩溃时,我在代码中随机得到下面的输出(与我能识别的任何操作无关)。有人能帮我解释一下logcat输出的含义吗

我截短了大部分文本,列出了各种线程及其状态(等待、定时等待、阻塞等),以及该线程上方法调用的堆栈跟踪

07-31 14:39:40.455 942-947/com.salesrabbit.android.sales.universal A/art: art/runtime/jdwp/jdwp_event.cc:681] Check failed: threadId != 0u (threadId=0, 0u=0) 
07-31 14:39:43.283 942-947/com.salesrabbit.android.sales.universal A/art: art/runtime/runtime.cc:422] Runtime aborting...
    art/runtime/runtime.cc:422] Aborting thread:
    art/runtime/runtime.cc:422] "Jit thread pool worker thread 0" prio=5 tid=2 WaitingForDebuggerSend (still starting up)
    art/runtime/runtime.cc:422]   | group="" sCount=0 dsCount=0 obj=0x0 self=0xa8617000
    art/runtime/runtime.cc:422]   | sysTid=947 nice=9 cgrp=default sched=0/0 handle=0xaf2a3920
    art/runtime/runtime.cc:422]   | state=R schedstat=( 8833095069 6087499776 14348 ) utm=557 stm=325 core=2 HZ=100
    art/runtime/runtime.cc:422]   | stack=0xaf1a5000-0xaf1a7000 stackSize=1022KB
    art/runtime/runtime.cc:422]   | held mutexes= "abort lock"
    art/runtime/runtime.cc:422]   native: #00 pc 00351069  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
    art/runtime/runtime.cc:422]   native: #01 pc 00331729  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
    art/runtime/runtime.cc:422]   native: #02 pc 003247a1  /system/lib/libart.so (_ZNK3art10AbortState10DumpThreadERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEPNS_6ThreadE+24)
    art/runtime/runtime.cc:422]   native: #03 pc 00324629  /system/lib/libart.so (_ZNK3art10AbortState4DumpERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEE+424)
    art/runtime/runtime.cc:422]   native: #04 pc 0031b351  /system/lib/libart.so (_ZN3art7Runtime5AbortEPKc+92)
    art/runtime/runtime.cc:422]   native: #05 pc 000b526b  /system/lib/libart.so (_ZN3art10LogMessageD2Ev+1134)
    art/runtime/runtime.cc:422]   native: #06 pc 00240305  /system/lib/libart.so (_ZN3art4JDWP9JdwpState19SetWaitForJdwpTokenEy+708)
    art/runtime/runtime.cc:422]   native: #07 pc 0023fb51  /system/lib/libart.so (_ZN3art4JDWP9JdwpState24AcquireJdwpTokenForEventEy+76)
    art/runtime/runtime.cc:422]   native: #08 pc 0023f5e1  /system/lib/libart.so (_ZN3art4JDWP9JdwpState29SendRequestAndPossiblySuspendEPNS0_9ExpandBufENS0_17JdwpSuspendPolicyEy+180)
    art/runtime/runtime.cc:422]   native: #09 pc 0024301b  /system/lib/libart.so (_ZN3art4JDWP9JdwpState16PostClassPrepareEPNS_6mirror5ClassE+914)
    art/runtime/runtime.cc:422]   native: #10 pc 000e4db5  /system/lib/libart.so (_ZN3art11ClassLinker11DefineClassEPNS_6ThreadEPKcjNS_6HandleINS_6mirror11ClassLoaderEEERKNS_7DexFileERKNS9_8ClassDefE+560)
    art/runtime/runtime.cc:422]   native: #11 pc 000e4a15  /system/lib/libart.so (_ZN3art11ClassLinker26FindClassInPathClassLoaderERNS_33ScopedObjectAccessAlreadyRunnableEPNS_6ThreadEPKcjNS_6HandleINS_6mirror11ClassLoaderEEEPPNS8_5ClassE+1016)
    art/runtime/runtime.cc:422]   native: #12 pc 000e55ef  /system/lib/libart.so (_ZN3art11ClassLinker9FindClassEPNS_6ThreadEPKcNS_6HandleINS_6mirror11ClassLoaderEEE+658)
    art/runtime/runtime.cc:422]   native: #13 pc 000d2a3d  /system/lib/libart.so (_ZN3art11ClassLinker11ResolveTypeERKNS_7DexFileEtNS_6HandleINS_6mirror8DexCacheEEENS4_INS5_11ClassLoaderEEE+132)
    art/runtime/runtime.cc:422]   native: #14 pc 001354bd  /system/lib/libart-compiler.so (_ZNK3art19HInstructionBuilder25IsOutermostCompilingClassEt+528)
    art/runtime/runtime.cc:422]   native: #15 pc 00134e5b  /system/lib/libart-compiler.so (_ZN3art19HInstructionBuilder16BuildNewInstanceEtj+626)
    art/runtime/runtime.cc:422]   native: #16 pc 0012ffe7  /system/lib/libart-compiler.so (_ZN3art19HInstructionBuilder21ProcessDexInstructionERKNS_11InstructionEj+3522)
    art/runtime/runtime.cc:422]   native: #17 pc 0012ece9  /system/lib/libart-compiler.so (_ZN3art19HInstructionBuilder5BuildEv+1176)
    art/runtime/runtime.cc:422]   native: #18 pc 00113b79  /system/lib/libart-compiler.so (_ZN3art13HGraphBuilder10BuildGraphEv+84)
    art/runtime/runtime.cc:422]   native: #19 pc 00157ea9  /system/lib/libart-compiler.so (_ZNK3art18OptimizingCompiler10TryCompileEPNS_14ArenaAllocatorEPNS_19CodeVectorAllocatorEPKNS_7DexFile8CodeItemEjNS_10InvokeTypeEtjP8_jobjectRKS5_NS_6HandleINS_6mirror8DexCacheEEEPNS_9ArtMethodEb+2452)
    art/runtime/runtime.cc:422]   native: #20 pc 00159ae3  /system/lib/libart-compiler.so (_ZN3art18OptimizingCompiler10JitCompileEPNS_6ThreadEPNS_3jit12JitCodeCacheEPNS_9ArtMethodEb+330)
    art/runtime/runtime.cc:422]   native: #21 pc 00108e1f  /system/lib/libart-compiler.so (_ZN3art3jit11JitCompiler13CompileMethodEPNS_6ThreadEPNS_9ArtMethodEb+194)
    art/runtime/runtime.cc:422]   native: #22 pc 00250473  /system/lib/libart.so (_ZN3art3jit3Jit13CompileMethodEPNS_9ArtMethodEPNS_6ThreadEb+318)
    art/runtime/runtime.cc:422]   native: #23 pc 00251b97  /system/lib/libart.so (_ZN3art3jit14JitCompileTask3RunEPNS_6ThreadE+430)
    art/runtime/runtime.cc:422]   native: #24 pc 003445a1  /system/lib/libart.so (_ZN3art16ThreadPoolWorker3RunEv+44)
    art/runtime/runtime.cc:422]   native: #25 pc 003440d9  /system/lib/libart.so (_ZN3art16ThreadPoolWorker8CallbackEPv+64)
    art/runtime/runtime.cc:422]   native: #26 pc 00047093  /system/lib/libc.so (_ZL15__pthread_startPv+22)
    art/runtime/runtime.cc:422]   native: #27 pc 00019bdd  /system/lib/libc.so (__start_thread+6)
    art/runtime/runtime.cc:422]   (no managed stack frames)
    art/runtime/runtime.cc:422] Dumping all threads without appropriate locks held: thread list lock mutator lock
    art/runtime/runtime.cc:422] All threads:
07-31 14:39:43.285 942-947/com.salesrabbit.android.sales.universal A/art: art/runtime/runtime.cc:422] DALVIK THREADS (470):
    art/runtime/runtime.cc:422] "Jit thread pool worker thread 0" prio=5 tid=2 Runnable (still starting up)
    art/runtime/runtime.cc:422]   | group="" sCount=0 dsCount=0 obj=0x0 self=0xa8617000
    art/runtime/runtime.cc:422]   | sysTid=947 nice=9 cgrp=default sched=0/0 handle=0xaf2a3920
    art/runtime/runtime.cc:422]   | state=R schedstat=( 9523364645 6173422596 15193 ) utm=559 stm=392 core=0 HZ=100
    art/runtime/runtime.cc:422]   | stack=0xaf1a5000-0xaf1a7000 stackSize=1022KB
    art/runtime/runtime.cc:422]   | held mutexes= "abort lock" "mutator lock"(shared held)
    art/runtime/runtime.cc:422]   native: #00 pc 00351069  /system/lib/libart.so (_ZN3art15DumpNativeStackERNSt3__113basic_ostreamIcNS0_11char_traitsIcEEEEiP12BacktraceMapPKcPNS_9ArtMethodEPv+128)
    art/runtime/runtime.cc:422]   native: #01 pc 00331729  /system/lib/libart.so (_ZNK3art6Thread9DumpStackERNSt3__113basic_ostreamIcNS1_11char_traitsIcEEEEbP12BacktraceMap+304)
    art/runtime/runtime.cc:422]   native: #02 pc 0034382f  /system/lib/libart.so (_ZN3art14DumpCheckpoint3RunEPNS_6T
我截断了一堆其他的线程

     --------- beginning of crash
07-31 14:39:43.630 942-947/com.salesrabbit.android.sales.universal A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 947 (Jit thread pool)
编辑1

昨天我把我的android studio从3.0.1升级到了3.1.3(还有gradle),这个问题一直持续到今天,午饭后它又随机出现了。我试图使缓存失效并重新启动android studio,但没有任何影响。在测试设备上构建/安装应用程序大约2分钟后,我仍然会遇到此崩溃。它发生在我们所有的测试设备上

编辑2

我刚刚发现,如果我关闭所有断点,崩溃就会消失。如果我把断点放回去,碰撞就会回来。这太烦人了

在下面的代码中,如果我在
db.endTransaction()
上设置断点,应用程序就会崩溃。为什么?我怎样才能解决这个问题

return Single.just(page)
    .map {
        val db: Database = daoSession.database
        db.beginTransaction()
        . . . .
        db.setTransactionSuccessful()
        db.endTransaction()
        return@map page
    }
    .map {
        geoCodeAsNeeded(page.addressToGeoCode)
        return@map page
    }
    .map {
        return someMethod()
    }
    .subscribeOn(Schedulers.io())

正如stack trace中的这一行所述:

tid 8509(Jit线程池)中的致命信号6(SIGABRT),代码-6

您的错误是SIGABRT信号

1) 不要阻塞UI线程,这可能会像操作系统那样导致SIGABRT 杀死无响应的应用程序

2) 确保在您的OnDestroy中,在您的活动中 自己打扫卫生。i、 e.删除所有侦听器/事件 然后给基地打电话

3) 一种外部(即BluetoothLeService)服务,可回调到 您的应用程序的侦听器现在为null/nil,这将导致挂起,从而导致 西格伯特,见第2页

更多答案:


如果您无法找到错误位置,您必须通过更改部分代码以注释来找到错误位置,以查看问题是否解决。

onDestroy的插入部分,您应该从顶部的
中删除列表器/事件,因为
onDestroy
不保证
并将它们注册回
onResume
@prashant17首先犯了两个错误始终使用对如果您在Resume中注册侦听器,您应该在Pause中注销它(或使用Start/Stop或使用Create/Destroy),使用您的方式活动可能会多次暂停并恢复,但不会停止,因此您会多次注册侦听器,但较新的是在停止之前注销它。第二个错误是,当未调用
onDestroy
时,所有进程都将终止,并且不需要注销侦听器。另外,
onStop
可能不会被称为
onDestroy
,尽管可能性较小。@向导,我正在使用Rx java,并且我的所有新代码都在io线程(Schedulers.io())上运行。堆栈跟踪还将出现问题的线程列为id=0,该线程都是本机调用。你知道是什么产生了那个线程吗。@Danio线程正在使用一个线程池“Jit线程池”有许多线程供工作线程并行工作,这里起始tid(线程id)为2,发生异常的线程有tid(线程id) 8509@WIZARD我用更多信息更新了我的问题。我遇到了同样的问题。我发现应用程序中挂着大量未使用的旧断点。清除所有这些并添加我当前调试会话所需的正确断点就可以做到这一点。你的编辑2是我步入正轨所需要的一切。谢谢!:)