我们的Android应用程序在猴子测试中遇到随机本机崩溃。我们有一些jni和本机C ++代码,并进行了一些修改以尝试解决该问题,但这没有帮助。崩溃堆栈没有足够的信息来帮助找到原因。
我只能静态查看jni和C ++代码,这很慢而且很无助。复查后问题仍然存在。我是Java开发人员,不擅长C ++,因此有可能错过了有问题的代码。 C ++代码库很大,因为我们使用了一些开源项目源代码。
以下是一些堆栈:
/ CRASH: com.my.app (pid 27393)
// Short Msg: Native crash
// Long Msg: Native crash: Segmentation fault
// Build Label: Lenovo/heart/heart:10/QKQ1.191014.001/11.5.250_200614:userdebug/test-keys
// Build Changelist: 11.5.250_200614
// Build Time: 1592147934000
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Build fingerprint: 'Lenovo/heart/heart:10/QKQ1.191014.001/11.5.250_200614:userdebug/test-keys'
// Revision: '0'
// ABI: 'arm'
// Timestamp: 2020-10-15 22:44:46+0800
// pid: 27393, tid: 27407, name: ReferenceQueueD >>> com.my.app <<<
// uid: 10291
// signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x4
// Cause: null pointer dereference
// r0 b7e49de0 r1 00000000 r2 f087cd15 r3 00000000
// r4 f087cd15 r5 139b8330 r6 139b8330 r7 139b82c8
// r8 00000000 r9 eb15f600 r10 70ea2bd8 r11 139b8308
// ip e5b72bd5 sp c7e43dc0 lr 71c713bb pc f087cd1c
//
// backtrace:
// #00 pc 000add1c /system/lib/libandroid_runtime.so (android::CanvasJNI::delete_canvas(android::Canvas*)+8) (BuildId: 474c53cb68297e45cf00595c65e14fff)
// #01 pc 0004a3b9 /system/framework/arm/boot-core-libart.oat (art_jni_trampoline+120) (BuildId: 533d0af7f4307f5a947d9059c8a7d3c40eb37d1b)
// #02 pc 000bb60f /system/framework/arm/boot-core-libart.oat (libcore.util.NativeAllocationRegistry$CleanerThunk.run+78) (BuildId: 533d0af7f4307f5a947d9059c8a7d3c40eb37d1b)
// #03 pc 0024574b /system/framework/arm/boot.oat (sun.misc.Cleaner.clean+90) (BuildId: 625e004ba4396bf9751878502697218d94469522)
// #04 pc 000d3849 /system/framework/arm/boot.oat (java.lang.ref.ReferenceQueue.enqueueLocked+168) (BuildId: 625e004ba4396bf9751878502697218d94469522)
// #05 pc 000d3925 /system/framework/arm/boot.oat (java.lang.ref.ReferenceQueue.enqueuePending+148) (BuildId: 625e004ba4396bf9751878502697218d94469522)
// #06 pc 000ef941 /system/framework/arm/boot-core-libart.oat (java.lang.Daemons$ReferenceQueueDaemon.runInternal+232) (BuildId: 533d0af7f4307f5a947d9059c8a7d3c40eb37d1b)
// #07 pc 0009e263 /system/framework/arm/boot-core-libart.oat (java.lang.Daemons$Daemon.run+146) (BuildId: 533d0af7f4307f5a947d9059c8a7d3c40eb37d1b)
// #08 pc 00173691 /system/framework/arm/boot.oat (java.lang.Thread.run+64) (BuildId: 625e004ba4396bf9751878502697218d94469522)
// #09 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #10 pc 0043d13d /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+248) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #11 pc 000dff81 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+168) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #12 pc 0037d507 /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+54) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #13 pc 0037e29b /apex/com.android.runtime/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+302) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #14 pc 003afeff /apex/com.android.runtime/lib/libart.so (art::Thread::CreateCallback(void*)+1018) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #15 pc 000ab3bd /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: b8ea1bc56f976308b1ee7e2335b3127e)
// #16 pc 00061989 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: b8ea1bc56f976308b1ee7e2335b3127e)
// CRASH: com.my.app (pid 10788)
// Short Msg: Native crash
// Long Msg: Native crash: Segmentation fault
// Build Label: Lenovo/heart/heart:10/QKQ1.191014.001/11.5.250_200614:userdebug/test-keys
// Build Changelist: 11.5.250_200614
// Build Time: 1592147934000
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Build fingerprint: 'Lenovo/heart/heart:10/QKQ1.191014.001/11.5.250_200614:userdebug/test-keys'
// Revision: '0'
// ABI: 'arm'
// Timestamp: 2020-10-16 01:51:56+0800
// pid: 10788, tid: 11437, name: RenderThread >>> com.my.app <<<
// uid: 10291
// signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x38
// Cause: null pointer dereference
// r0 c5ddb380 r1 00000000 r2 c607d148 r3 00000000
// r4 bebe9710 r5 c607d148 r6 00000000 r7 bebe9000
// r8 ef9a30c0 r9 ef9a30e4 r10 ef9a30e8 r11 f050c018
// ip ef9a3a28 sp c607d070 lr ef98611b pc ef95e6b8
//
// backtrace:
// #00 pc 0005a6b8 /system/lib/libgui.so (android::HpGraphicBufferProducer::query(int, int*)+4) (BuildId: 4aade65846c0a0844ffc6abd2cfae7f4)
// #01 pc 00082119 /system/lib/libgui.so (android::Surface::query(int, int*) const+132) (BuildId: 4aade65846c0a0844ffc6abd2cfae7f4)
// #02 pc 001f9073 /system/lib/libhwui.so (android::uirenderer::renderthread::CanvasContext::getNextFrameSize() const+20) (BuildId: 27f32025e8036c1421e970591d6452bf)
// #03 pc 001f9045 /system/lib/libhwui.so (android::uirenderer::TreeInfo::TreeInfo(android::uirenderer::TreeInfo::TraversalMode, android::uirenderer::renderthread::CanvasContext&)+104) (BuildId: 27f32025e8036c1421e970591d6452bf)
// #04 pc 001f8da7 /system/lib/libhwui.so (android::uirenderer::renderthread::DrawFrameTask::run()+74) (BuildId: 27f32025e8036c1421e970591d6452bf)
// #05 pc 0020742d /system/lib/libhwui.so (android::uirenderer::WorkQueue::process()+164) (BuildId: 27f32025e8036c1421e970591d6452bf)
// #06 pc 0020727f /system/lib/libhwui.so (android::uirenderer::renderthread::RenderThread::threadLoop()+54) (BuildId: 27f32025e8036c1421e970591d6452bf)
// #07 pc 0000d96f /system/lib/libutils.so (android::Thread::_threadLoop(void*)+210) (BuildId: 303a9d221465f0db9b5d760e0a0c6abe)
// #08 pc 000ab3bd /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: b8ea1bc56f976308b1ee7e2335b3127e)
// #09 pc 00061989 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: b8ea1bc56f976308b1ee7e2335b3127e)
// CRASH: com.my.app (pid 7417)
// Short Msg: Native crash
// Long Msg: Native crash: Segmentation fault
// Build Label: Lenovo/heart/heart:10/QKQ1.191014.001/11.5.250_200614:userdebug/test-keys
// Build Changelist: 11.5.250_200614
// Build Time: 1592147934000
// *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
// Build fingerprint: 'Lenovo/heart/heart:10/QKQ1.191014.001/11.5.250_200614:userdebug/test-keys'
// Revision: '0'
// ABI: 'arm'
// Timestamp: 2020-10-16 07:57:24+0800
// pid: 7417, tid: 28261, name: speakLocal tts >>> com.my.app <<<
// uid: 10291
// signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xfffffff4
// r0 df8becc0 r1 00000000 r2 00000000 r3 00000001
// r4 df81ad20 r5 b356b6e0 r6 ef17a9b1 r7 000000a8
// r8 00000000 r9 ef1a4ad4 r10 ef1a4d08 r11 0065c5c0
// ip ef1a4ec4 sp b356b690 lr ef1933fd pc ef1935b4
//
// backtrace:
// #00 pc 000445b4 /system/lib/libmedia.so (android::IMediaDeathNotifier::getMediaPlayerService()+476) (BuildId: 4c77835059177de2000d6c39f9539962)
// #01 pc 0002b9cf /system/lib/libmedia.so (android::MediaPlayer::setDataSource(int, long long, long long)+30) (BuildId: 4c77835059177de2000d6c39f9539962)
// #02 pc 0003b873 /system/lib/libmedia_jni.so (android_media_MediaPlayer_setDataSourceFD(_JNIEnv*, _jobject*, _jobject*, long long, long long)+118) (BuildId: c190a7c755ffba7708c716e1dd16c0a1)
// #03 pc 0029c637 /system/framework/arm/boot-framework.oat (art_jni_trampoline+126) (BuildId: 39c685939f0d8867d4162c7a38d63ad3600807fd)
// #04 pc 006ce41b /system/framework/arm/boot-framework.oat (android.media.MediaPlayer.setDataSource+58) (BuildId: 39c685939f0d8867d4162c7a38d63ad3600807fd)
// #05 pc 006ce365 /system/framework/arm/boot-framework.oat (android.media.MediaPlayer.setDataSource+172) (BuildId: 39c685939f0d8867d4162c7a38d63ad3600807fd)
// #06 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #07 pc 0043d13d /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+248) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #08 pc 000dff81 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+168) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #09 pc 00214673 /apex/com.android.runtime/lib/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+270) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #10 pc 00210867 /apex/com.android.runtime/lib/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+738) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #11 pc 00437927 /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtualQuick+458) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #12 pc 000d6594 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual_quick+20) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #13 pc 00455d68 /data/app/com.lenovo.menu_assistant-XzP2MzG5jMAB7n94-EP3IQ==/oat/arm/base.vdex (sy.B+1356)
// #14 pc 00437b91 /apex/com.android.runtime/lib/libart.so (MterpInvokeVirtualQuick+1076) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #15 pc 000d6594 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_virtual_quick+20) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #16 pc 004555cc /data/app/com.lenovo.menu_assistant-XzP2MzG5jMAB7n94-EP3IQ==/oat/arm/base.vdex (sy.e)
// #17 pc 00434c9f /apex/com.android.runtime/lib/libart.so (MterpInvokeStatic+934) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #18 pc 000d2994 /apex/com.android.runtime/lib/libart.so (mterp_op_invoke_static+20) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #19 pc 00453e6c /data/app/com.lenovo.menu_assistant-XzP2MzG5jMAB7n94-EP3IQ==/oat/arm/base.vdex (sy$g.run+12)
// #20 pc 001f068f /apex/com.android.runtime/lib/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.8590219860024250152+166) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #21 pc 001f50a3 /apex/com.android.runtime/lib/libart.so (art::interpreter::EnterInterpreterFromEntryPoint(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*)+122) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #22 pc 00426b97 /apex/com.android.runtime/lib/libart.so (artQuickToInterpreterBridge+866) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #23 pc 000dc5a1 /apex/com.android.runtime/lib/libart.so (art_quick_to_interpreter_bridge+32) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #24 pc 00173691 /system/framework/arm/boot.oat (java.lang.Thread.run+64) (BuildId: 625e004ba4396bf9751878502697218d94469522)
// #25 pc 000d7bc5 /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub_internal+68) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #26 pc 0043d13d /apex/com.android.runtime/lib/libart.so (art_quick_invoke_stub+248) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #27 pc 000dff81 /apex/com.android.runtime/lib/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+168) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #28 pc 0037d507 /apex/com.android.runtime/lib/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+54) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #29 pc 0037e29b /apex/com.android.runtime/lib/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+302) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #30 pc 003afeff /apex/com.android.runtime/lib/libart.so (art::Thread::CreateCallback(void*)+1018) (BuildId: 78cb259cd8aba2a9f6063413910ab653)
// #31 pc 000ab3bd /apex/com.android.runtime/lib/bionic/libc.so (__pthread_start(void*)+20) (BuildId: b8ea1bc56f976308b1ee7e2335b3127e)
// #32 pc 00061989 /apex/com.android.runtime/lib/bionic/libc.so (__start_thread+30) (BuildId: b8ea1bc56f976308b1ee7e2335b3127e)