Google Play内测com.rainpixels.unipeople x86原生崩溃求助
x86架构设备原生崩溃排查
问题场景
- 应用上传至Google Play Console开展内部测试时,在低配x86架构设备上触发原生崩溃,暂无法定位故障根因
崩溃日志
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** Build fingerprint: 'generic/gce_x86_phone/gce_x86:9/PGR1.190916.001/5877764:userdebug/test-keys' Revision: '0' ABI: 'x86' pid: 6928, tid: 8107, name: 1.raster >>> com.rainpixels.unipeople <<< signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr -------- Abort message: 'vendor/unbundled_google/libs/ndk_translation/ndk_translation/ir/include/ndk_translation/ir/ir.h:685: CHECK failed: IsAligned(offset, GetFormatSize(format))' eax 00000000 ebx 00001b10 ecx 00001fab edx 00000006 edi 00001b10 esi cbd86b5c ebp cbd86b28 esp cbd86ab8 eip f6819be9 backtrace: #00 pc 00000be9 [vdso:f6819000] (__kernel_vsyscall+9) #01 pc 0001fdf8 /system/lib/libc.so (syscall+40) #02 pc 00022e73 /system/lib/libc.so (abort+115) #03 pc 00006c84 /system/lib/liblog.so (__android_log_assert+292) #04 pc 0009f2b4 /system/lib/libndk_translation.so (ndk_translation::GetInsn::GetInsn(ndk_translation::IR*, ndk_translation::Format, unsigned int)+276) #05 pc 0009f100 /system/lib/libndk_translation.so (ndk_translation::IRBuilder::Get(ndk_translation::Format, unsigned int)+144) #06 pc 0009dd2e /system/lib/libndk_translation.so (ndk_translation::(anonymous namespace)::InsnBuilder::Get(ndk_translation::Format, unsigned int)+46) #07 pc 000d0b4b /system/lib/libndk_translation.so (ndk_translation::SemanticsDecoder::VTBL(ndk_translation::VTBL_Args const&)+363) #08 pc 00100568 /system/lib/libndk_translation.so (ndk_translation::ArmDecoder::TranslateThumbInsn(unsigned short const*)+86104) #09 pc 0009c2b6 /system/lib/libndk_translation.so (ndk_translation::(anonymous namespace)::GenerateIRHelper(ndk_translation::CompilerHooks*, unsigned int, unsigned int, ndk_translation::IR*)+1142) #10 pc 0009be1f /system/lib/libndk_translation.so (ndk_translation::GenerateIR(ndk_translation::CompilerHooks*, unsigned int, ndk_translation::IR*, unsigned int*)+47) #11 pc 0009bbdf /system/lib/libndk_translation.so (ndk_translation::Compile(ndk_translation::CompilerHooks*, unsigned int, ndk_translation::GuestCodeEntry*, unsigned int*, ndk_translation::MachineCode*)+143) #12 pc 0007a0da /system/lib/libndk_translation.so (ndk_translation::(anonymous namespace)::Translate(ndk_translation::TranslationCache*, unsigned int, ndk_translation::GuestCodeEntry*)+378) #13 pc 00079f1c /system/lib/libndk_translation.so (ndk_translation_HandleNotTranslated+300) #14 pc 0018db57 /system/lib/libndk_translation.so
根因判断
崩溃调用栈全部位于系统libndk_translation.so库中,这是Android系统提供的ARM指令转x86指令的动态翻译层,崩溃触发点是翻译层在处理ARM NEON的VTBL(向量查表)指令时,检测到内存偏移不符合对齐要求,触发断言主动退出。
这类崩溃不是业务Java层代码导致,也不是原生代码直接访问非法内存触发,属于二进制翻译层的兼容性问题。
崩溃线程名为
1.raster,属于图像渲染、像素处理类工作线程,优先排查应用内图片处理、滤镜、自定义渲染相关的原生模块,以及对应引入的第三方SDK。
修复方案
按优先级从高到低尝试:
- 编译x86架构原生so:在模块
build.gradle的ndk.abiFilters配置中新增x86架构目标,编译对应架构的原生库,应用在x86设备上直接运行原生x86指令,完全跳过翻译层,可直接解决该问题。 - 取消x86架构分发:目前消费级市场x86架构安卓设备占比不足0.2%,本次触发崩溃的还是Google云测的x86模拟器而非实体机,如果包体积受限无法新增x86架构产出,可直接在Google Play控制台关闭x86架构的分发规则,不影响正常用户使用。
- 调整原生编译配置:如果必须兼容x86翻译运行场景,检查自身原生代码以及接入的第三方SDK原生库,排查是否存在手写NEON汇编、编译优化等级过高(-O3及以上)导致生成非对齐内存访问的VTBL指令序列,可将对应原生模块的优化等级下调至
-O2,或给全局内存访问添加对齐属性约束。
内容的提问来源于stack exchange,提问作者RoyalCoder
相关产品推荐
相关产品推荐

