GithubHelp home page GithubHelp logo

Comments (3)

shifujun avatar shifujun commented on June 2, 2024

你贴的堆栈只能说明你用的不是这个项目的原始代码。而你又不愿意分享你修改后的代码。所以这没有开源项目的交流前提。

即便如此。你想知道在你拿了代码修改之后,上游项目改了什么。你可以简单的用git diff看出来多出来哪些提交,那些文件有差异。如果这些提交的提交日志不清晰,如果文件的改动看不懂,都可以直接引用提issue。要求改进也是合理的。直接提PR改进代码可读性也是欢迎的。

dex和oat都属于Android的私有api,shadow从原理上不考虑介入。

from shadow.

yangxy112683 avatar yangxy112683 commented on June 2, 2024

你贴的堆栈只能说明你用的不是这个项目的原始代码。而你又不愿意分享你修改后的代码。所以这没有开源项目的交流前提。

即便如此。你想知道在你拿了代码修改之后,上游项目改了什么。你可以简单的用git diff看出来多出来哪些提交,那些文件有差异。如果这些提交的提交日志不清晰,如果文件的改动看不懂,都可以直接引用提issue。要求改进也是合理的。直接提PR改进代码可读性也是欢迎的。

dex和oat都属于Android的私有api,shadow从原理上不考虑介入。

这里并没有对 Shadow 的 loadPlugin 相关流程以及代码做过修改,只是为了解决项目中其他第三方组件也使用了 shadow,导致包名冲突,将 com.tencent.shadow 修改为 com.tencent.estv.shadow;

如果说的是删除 oat 的逻辑,目前只是在 Shadow 提供的示例 FastPluginManager的 loadPlugin()方法中,增加了删除oat 文件的操作,为了避免Android P 内联优化导致的问题, 以下是相关代码;

    protected void loadPlugin(InstalledPlugin installedPlugin, String partKey, Boolean multiProcess) throws RemoteException, TimeoutException, FailedException {
        loadPluginLoaderAndRuntime(installedPlugin.UUID, partKey, multiProcess);
        Map map = mPluginLoader.getLoadedPlugin();
        if (!map.containsKey(partKey)) {
            delOatDir(installedPlugin);
            mPluginLoader.loadPlugin(partKey);
        }
    }

针对上游项目后续的改动,看到有针对 API 27 去掉 odex 的过程,这里会同步更新下相关改动尝试下。
API 26 保留 odex 过程

但该问题是在sdk 升级到 targetSDKVersion = 30 时才出现,不确认是否是否该问题导致,后续如还有发现的话,会将 shadow 上游改动同步到项目中

from shadow.

yangxy112683 avatar yangxy112683 commented on June 2, 2024

获取到更详细的崩溃堆栈,目前看起来是崩溃在runtime 中的 vdex_file.cc中的GetNextDexFileData()方法,该方法在 Android12中引入, 在 Android12 版本的源码中,有CHECK_ALIGN(data,4)的检查
image

该 check 在 Android13 版本中去掉了
image

estPlugi: vdex_file.cc:195] Check failed: ::art::IsAligned<4>(data) 0x7d4f902246
estPlugi: runtime.cc:689] Runtime aborting...
estPlugi: runtime.cc:689] Dumping all threads without mutator lock held
estPlugi: runtime.cc:689] All threads:
estPlugi: runtime.cc:689] DALVIK THREADS (42):
estPlugi: runtime.cc:689] "pool-7-thread-1" prio=5 tid=33 Runnable
estPlugi: runtime.cc:689] | group="" sCount=0 ucsCount=0 flags=0 obj=0x1329d3a8 self=0xb400007bd05e7000
estPlugi: runtime.cc:689] | sysTid=31136 nice=0 cgrp=foreground sched=0/0 handle=0x7bc2095cb0
estPlugi: runtime.cc:689] | state=R schedstat=( 39925522 1402602 21 ) utm=2 stm=1 core=6 HZ=100
estPlugi: runtime.cc:689] | stack=0x7bc1f92000-0x7bc1f94000 stackSize=1039KB
estPlugi: runtime.cc:689] | held mutexes= "abort lock" "mutator lock"(shared held)
estPlugi: runtime.cc:689] native: #00 pc 00000000005842b4 /apex/com.android.art/lib64/libart.so (art::DumpNativeStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, int, BacktraceMap*, char const*, art::ArtMethod*, void*, bool)+140)
estPlugi: runtime.cc:689] native: #01 pc 00000000006b3b58 /apex/com.android.art/lib64/libart.so (art::Thread::DumpStack(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool, BacktraceMap*, bool) const+364)
estPlugi: runtime.cc:689] native: #02 pc 00000000006d20d8 /apex/com.android.art/lib64/libart.so (art::DumpCheckpoint::Run(art::Thread*)+944)
estPlugi: runtime.cc:689] native: #03 pc 00000000006cb964 /apex/com.android.art/lib64/libart.so (art::ThreadList::RunCheckpoint(art::Closure*, art::Closure*)+564)
estPlugi: runtime.cc:689] native: #04 pc 00000000006cab10 /apex/com.android.art/lib64/libart.so (art::ThreadList::Dump(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, bool)+1504)
estPlugi: runtime.cc:689] native: #05 pc 000000000065d62c /apex/com.android.art/lib64/libart.so (art::Runtime::Abort(char const*)+2240)
estPlugi: runtime.cc:689] native: #06 pc 00000000000159e0 /system/lib64/libbase.so (android::base::SetAborter(std::__1::function<void (char const*)>&&)::$_3::__invoke(char const*)+76)
estPlugi: runtime.cc:689] native: #07 pc 0000000000015004 /system/lib64/libbase.so (android::base::LogMessage::~LogMessage()+484)
estPlugi: runtime.cc:689] native: #08 pc 00000000006e2550 /apex/com.android.art/lib64/libart.so (art::VdexFile::GetNextTypeLookupTableData(unsigned char const*, unsigned int) const+152)
estPlugi: runtime.cc:689] native: #09 pc 00000000005c5414 /apex/com.android.art/lib64/libart.so (art::OatFileBase::Setup(std::__1::vector<art::DexFile const*, std::__1::allocator<art::DexFile const*> > const&)+148)
estPlugi: runtime.cc:689] native: #10 pc 00000000005c998c /apex/com.android.art/lib64/libart.so (art::OatFile::OpenFromVdex(int, std::__1::unique_ptr<art::VdexFile, std::__1::default_delete<art::VdexFile> >&&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+1204)
estPlugi: runtime.cc:689] native: #11 pc 00000000005cfc3c /apex/com.android.art/lib64/libart.so (art::OatFileAssistant::OatFileInfo::GetFile()+904)
estPlugi: runtime.cc:689] native: #12 pc 00000000005cf14c /apex/com.android.art/lib64/libart.so (art::OatFileAssistant::OatFileInfo::Status()+72)
estPlugi: runtime.cc:689] native: #13 pc 00000000005cef30 /apex/com.android.art/lib64/libart.so (art::OatFileAssistant::GetBestInfo(bool)+116)
estPlugi: runtime.cc:689] native: #14 pc 00000000005d2d14 /apex/com.android.art/lib64/libart.so (art::OatFileAssistant::GetOptimizationStatus(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >*)+64)
estPlugi: runtime.cc:689] native: #15 pc 00000000005d41ac /apex/com.android.art/lib64/libart.so (art::OatFileManager::OpenDexFilesFromOat(char const*, _jobject*, _jobjectArray*, art::OatFile const**, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >*)+616)
estPlugi: runtime.cc:689] native: #16 pc 0000000000588658 /apex/com.android.art/lib64/libart.so (art::DexFile_openDexFileNative(_JNIEnv*, _jclass*, _jstring*, _jstring*, int, _jobject*, _jobjectArray*)+144)
estPlugi: runtime.cc:689] at dalvik.system.DexFile.openDexFileNative(Native method)
estPlugi: runtime.cc:689] at dalvik.system.DexFile.openDexFile(DexFile.java:371)
estPlugi: runtime.cc:689] at dalvik.system.DexFile.<init>(DexFile.java:113)
estPlugi: runtime.cc:689] at dalvik.system.DexFile.<init>(DexFile.java:86)
estPlugi: runtime.cc:689] at dalvik.system.DexPathList.loadDexFile(DexPathList.java:438)
estPlugi: runtime.cc:689] at dalvik.system.DexPathList.makeDexElements(DexPathList.java:397)
estPlugi: runtime.cc:689] at dalvik.system.DexPathList.<init>(DexPathList.java:166)
estPlugi: runtime.cc:689] at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:134)
estPlugi: runtime.cc:689] at dalvik.system.BaseDexClassLoader.<init>(BaseDexClassLoader.java:92)
estPlugi: runtime.cc:689] at com.tencent.estv.shadow.core.loader.classloaders.PluginClassLoader.<init>(unavailable:-1)
estPlugi: runtime.cc:689] at com.tencent.estv.shadow.core.loader.blocs.LoadApkBloc.loadPlugin(unavailable:-1)
estPlugi: runtime.cc:689] at com.tencent.estv.shadow.core.loader.blocs.LoadPluginBloc$loadPlugin$buildClassLoader$1.call(unavailable:-1)
estPlugi: runtime.cc:689] at com.tencent.estv.shadow.core.loader.blocs.LoadPluginBloc$loadPlugin$buildClassLoader$1.call(unavailable:-1)
estPlugi: runtime.cc:689] at java.util.concurrent.FutureTask.run(FutureTask.java:266)
estPlugi: runtime.cc:689] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
estPlugi: runtime.cc:689] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
estPlugi: runtime.cc:689] at java.lang.Thread.run(Thread.java:930)
estPlugi: runtime.cc:689]

from shadow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.