【问题标题】:What is causing this crash with output "Check failed: threadId != 0u"?输出“检查失败:threadId!= 0u”导致此崩溃的原因是什么?
【发布时间】:2018-07-27 20:39:12
【问题描述】:

当我的应用程序崩溃时,我的代码中随机出现以下输出(与我可以识别的任何操作无关)。有人可以帮我解读一下这个 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())

【问题讨论】:

  • 我遇到了同样的问题。我发现我有大量旧的未使用断点挂在应用程序周围。清除所有这些并添加我当前调试会话所需的正确断点就可以了。你的 EDIT2 是我走上正轨所需要的。谢谢! :) ??????????

标签: android android-studio debugging kotlin rx-java


【解决方案1】:

正如堆栈跟踪中的这一行所说:

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

您的错误是 SIGABRT 信号

1) 不要阻塞 UI 线程,这可能会导致 SIGABRT,因为操作系统会 杀死一个无响应的应用程序。

2) 确保在您的 Activity 中的 OnDestroy 中,您是 自己打扫干净。即删除所有侦听器/事件 然后调用 Base.OnDestory。

3) 一个外部(即 BluetoothLeService)服务回调到 您的应用程序与现在 null/nil 的侦听器将导致挂起,因此 SIGABRT,见 #2

更多答案:What is fatal signal 6 in android logcat

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

【讨论】:

  • Insetad of onDestroy 你应该从onStop 中删除你的listners/events,因为onDestroy 不是guaranteed 并将它们注册回onResume
  • @prashant17 您首先犯了两个错误,如果您在 Resume 中注册侦听器,请始终使用对,您应该在 Pause 中取消注册它(或使用 Start/Stop 或使用 Create/Destroy),使用您的 Activity 可能去的方式暂停和恢复多次而不停止,因此您多次注册侦听器但较新的取消注册它直到停止。第二个错误是当onDestroy 没有被调用时,你的所有进程都会被终止,并且不需要注销监听器。 onStop 也可能不会被称为 onDestroy 虽然不太可能。
  • @WIZARD,我正在使用 Rx java,我所有的新代码都在 io 线程上运行 (Schedulers.io()) 堆栈跟踪还将有问题的线程列为 id=0,该线程都是本机调用。你知道是什么产生了那个线程吗?
  • @DanAnderson io 线程正在使用线程池“Jit 线程池”有许多线程供工作线程在此处并行工作,从 tid(线程 id)为 2 并且发生异常的线程有 tid (线程 id)8509
  • @WIZARD 我已经用更多信息更新了我的问题。
【解决方案2】:

只需关闭 Windows Defender。关闭防御者的所有开关。

【讨论】:

  • 您的答案可以通过额外的支持信息得到改进。请edit 添加更多详细信息,例如引用或文档,以便其他人可以确认您的答案是正确的。你可以找到更多关于如何写好答案的信息in the help center
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-05
  • 1970-01-01
  • 2011-09-29
  • 2011-04-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多