Meituan-Dianping / Robust

Robust is an Android HotFix solution with high compatibility and high stability. Robust can fix bugs immediately without a reboot.
Apache License 2.0
4.43k stars 809 forks source link

多进程应用下的SIGBUS(BUS_ADRERR)错误 #443

Closed cocomikes closed 1 year ago

cocomikes commented 3 years ago

异常类型:app运行时异常

手机型号:REDMI K30, 手机系统版本:Android 10, Robust版本:0.4.99 Gradle版本:5.4.1 系统:Android 堆栈/日志: # Thread-13(9697) SIGBUS(BUS_ADRERR)

_#00 pc 0004c252 /apex/com.android.runtime/lib/libartbase.so (OpenArchiveInternal(ZipArchive, char const)+897) [armeabi-v7a]

2 #01 pc 00022e97 /apex/com.android.runtime/lib/libartbase.so (art::ZipArchive::OpenFromFd(int, char const, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >)+26) [armeabi-v7a] 3 #02 pc 000140bf /apex/com.android.runtime/lib/libdexfile.so (art::ArtDexFileLoader::GetMultiDexChecksums(char const, std::1::vector<unsigned int, std::1::allocator >, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >, int, bool) const+170) [armeabi-v7a] 4 #03 pc 003368e1 /apex/com.android.runtime/lib/libart.so (art::OatFileAssistant::GetRequiredDexChecksums()+104) [armeabi-v7a] 5 #04 pc 00336a75 /apex/com.android.runtime/lib/libart.so (art::OatFileAssistant::DexChecksumUpToDate(art::VdexFile const&, std::1::basic_string<char, std::__1::char_traits, std::1::allocator >)+28) [armeabi-v7a] 6 #05 pc 00336e89 /apex/com.android.runtime/lib/libart.so (art::OatFileAssistant::GivenOatFileStatus(art::OatFile const&)+60) [armeabi-v7a] 7 #06 pc 003357cf /apex/com.android.runtime/lib/libart.so (art::OatFileAssistant::OatFileInfo::Status()+50) [armeabi-v7a] 8 #07 pc 0033560d /apex/com.android.runtime/lib/libart.so (art::OatFileAssistant::GetDexOptNeeded(art::CompilerFilter::Filter, bool, bool, art::ClassLoaderContext, std::1::vector<int, std::1::allocator > const&)+64) [armeabi-v7a] 9 #08 pc 003092a1 /apex/com.android.runtime/lib/libart.so (art::DexFile_getDexOptNeeded(_JNIEnv, _jclass, _jstring, _jstring, _jstring, _jstring, unsigned char, unsigned char)+924) [armeabi-v7a] 10 #09 pc 002c4d23 /system/framework/arm/boot-core-libart.oat [armeabi]_

_java:

12 android.app.DexLoadReporter.getDexoptNeeded(DexLoadReporter.java:101) 13 android.app.DexLoadReporter.notifyPackageManager(DexLoadReporter.java:162) 14 android.app.DexLoadReporter.report(DexLoadReporter.java:132) 15 dalvik.system.BaseDexClassLoader.reportClassLoaderChain(BaseDexClassLoader.java:191) 16 dalvik.system.DexPathList.makeDexElements(DexPathList.java:439) 17 dalvik.system.DexPathList.(DexPathList.java:164) 18 dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:126) 19 dalvik.system.BaseDexClassLoader.(BaseDexClassLoader.java:84) 20 dalvik.system.DexClassLoader.(DexClassLoader.java:55) 21 com.meituan.robust.PatchExecutor.patch(PatchExecutor.java:5) 22 com.meituan.robust.PatchExecutor.applyPatchList(PatchExecutor.java:7) 23 com.meituan.robust.PatchExecutor.run(PatchExecutor.java:2)_


后台监控此类型BUG数量上升很快,逐条查看后,发现都是日志信息都提到了xx.xx.xx:pushcore#Thread-13(9697)。 :pushcore进程是极光推送的所属进程, #Thread-13(9697) 是APP内将robust的初始化另开了线程,在此线程内初始化。 有疑问:

  1. 多进程应用,robust的初始化(即PatchExecutor的执行)能不能放在非主进程执行?
  2. 非主进程下报错,难道是ClassLoader的进程隔离会大概率影响到热修复类的加载?
  3. 初始化robust时,能不能放在单独的Thread里? eg: Thread { robust init code }.start()
liping12345 commented 3 years ago

+1

TonyAnmoo commented 3 years ago

+1

zhgz commented 3 years ago

+1