垃圾清理so报错


报错堆栈

07-07 09:59:28.315  9590  9590 I DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
07-07 09:59:28.315  9590  9590 I DEBUG   : Build fingerprint: 'vivo/bbk6752_lwt_l/bbk6752_lwt_l:5.0/LRX21M/1439438287:eng/release-keys'
07-07 09:59:28.315  9590  9590 I DEBUG   : Revision: '0'
07-07 09:59:28.315  9590  9590 I DEBUG   : ABI: 'arm64'
07-07 09:59:28.316  9590  9590 I DEBUG   : pid: 9422, tid: 9579, name: tmsdkobf.gc$1  >>> com.iqoo.secure <<<
07-07 09:59:28.316  9590  9590 I DEBUG   : signal 6 (SIGABRT), code -6 (SI_TKILL), fault addr --------
07-07 09:59:28.438  9590  9590 I DEBUG   : Abort message: 'art/runtime/thread.cc:1115] No pending exception expected: java.lang.NullPointerException: Attempt to read from field 'long com.iqoo.secure.ui.phoneoptimize.utils.ListItemInfo.appSize' on a null object reference'
07-07 09:59:28.438  9590  9590 I DEBUG   :     x0   0000000000000000  x1   000000000000256b  x2   0000000000000006  x3   0000007f7e517000
07-07 09:59:28.438  9590  9590 I DEBUG   :     x4   0000007f7e517000  x5   0000000000000005  x6   0000000000000001  x7   0000000000000020
07-07 09:59:28.438  9590  9590 I DEBUG   :     x8   0000000000000083  x9   0000007f997fb000  x10  0000007f997fd4c0  x11  0000000000000001
07-07 09:59:28.438  9590  9590 I DEBUG   :     x12  0000000000000001  x13  0000000000000000  x14  0000000000000000  x15  0000000000000001
07-07 09:59:28.439  9590  9590 I DEBUG   :     x16  0000007f9d15a6e8  x17  0000007f9d0fb48c  x18  0000000000000000  x19  0000007f7e517000
07-07 09:59:28.439  9590  9590 I DEBUG   :     x20  0000007f7c4ffb90  x21  0000007f9d160000  x22  000000000000000b  x23  0000000000000006
07-07 09:59:28.439  9590  9590 I DEBUG   :     x24  0000000000000005  x25  0000007f9987c740  x26  0000007f85169800  x27  0000007f85169800
07-07 09:59:28.439  9590  9590 I DEBUG   :     x28  0000007f83d3d000  x29  0000007f7c4fc450  x30  0000007f9d0bc6e4
07-07 09:59:28.439  9590  9590 I DEBUG   :     sp   0000007f7c4fc450  pc   0000007f9d0fb494  pstate 0000000060000000
07-07 09:59:28.439  9590  9590 I DEBUG   : 
07-07 09:59:28.439  9590  9590 I DEBUG   : backtrace:
07-07 09:59:28.439  9590  9590 I DEBUG   :     #00 pc 000000000005e494  /system/lib64/libc.so (tgkill+8)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #01 pc 000000000001f6e0  /system/lib64/libc.so (pthread_kill+160)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #02 pc 0000000000020c14  /system/lib64/libc.so (raise+28)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #03 pc 000000000001a6bc  /system/lib64/libc.so (abort+60)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #04 pc 00000000002e8994  /system/lib64/libart.so (art::Runtime::Abort()+212)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #05 pc 00000000000ce678  /system/lib64/libart.so (art::LogMessage::~LogMessage()+2684)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #06 pc 00000000002ff1c0  /system/lib64/libart.so (_ZNK3art6Thread24AssertNoPendingExceptionEv.part.149+940)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #07 pc 0000000000111498  /system/lib64/libart.so (art::ClassLinker::FindClass(art::Thread*, char const*, art::Handle<art::mirror::ClassLoader>)+56)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #08 pc 00000000002680fc  /system/lib64/libart.so (art::JNI::FindClass(_JNIEnv*, char const*)+1376)
07-07 09:59:28.440  9590  9590 I DEBUG   :     #09 pc 000000000001a4dc  /system/lib64/libdce-1.1.3-mfr.so  android-ndk-r10c/platforms/android-21/arch-arm64/usr/include/jni.h:519
07-07 09:59:28.440  9590  9590 I DEBUG   :     #10 pc 000000000001b220  /system/lib64/libdce-1.1.3-mfr.so  PiDeepClean/jni/ext/deepclean/SoftPathScanner.cpp:844
07-07 09:59:28.440  9590  9590 I DEBUG   :     #11 pc 000000000001b37c  /system/lib64/libdce-1.1.3-mfr.so  android-ndk-r10c/sources/cxx-stl/stlport/stlport/stl/_hashtable.h:502
07-07 09:59:28.440  9590  9590 I DEBUG   :     #12 pc 000000000001ba10  /system/lib64/libdce-1.1.3-mfr.so  PiDeepClean/jni/ext/deepclean/SoftPathScanner.cpp:843
07-07 09:59:28.441  9590  9590 I DEBUG   :     #13 pc 0000000000007dc4  /system/lib64/libdce-1.1.3-mfr.so  PiDeepClean/jni/main.cpp:248   ((SoftPathScanner *)ptr)->startScan(env, strPath);
07-07 09:59:28.441  9590  9590 I DEBUG   :     #14 pc 00000000000c830c  /system/lib64/libart.so (art_quick_generic_jni_trampoline+140)
07-07 09:59:28.441  9590  9590 I DEBUG   :     #15 pc 00000000000c3444  /system/lib64/libart.so (art_quick_invoke_stub+564)

PiDeepClean/jni/ext/deepclean/SoftPathScanner.cpp

<?prettify linenums=841?>

    isFind = isFindRootPath(fileName);
    LOGV("isFindRootPath %d %s", isFind, fileName);
    if(isFind) {
        bool isEmpty = scanSoftRootPath(fileName);
        if(isEmpty) {
//          int len = strlen(fileNa

从代码看应该是844行有问题,展开844行的代码

<?prettify linenums=324?>

bool SoftPathScanner::scanSoftRootPath(const char rootPathName)
{
    if(mScanEnv == NULL || mThiz == NULL || rootPathName == NULL || mIsScanCancled) {
        return false;
    }
    bool ret = true;

LOGV("scanSoftRootPath %s", rootPathName);
SoftPathInfo info; info.rootPath = rootPathName; info.detailPathsVector = new vector<char
>(); info.notScanPathsVector = new vector(); info.detailPathsDiffByDays = new vector();
//获取详细路径 jstring path = mScanEnv->NewStringUTF(rootPathName); jstring detailPaths = (jstring)mScanEnv->CallObjectMethod(mThiz, methodIdofgetRootPathDetailPath, path); getDetailPaths(&info, detailPaths); mScanEnv->DeleteLocalRef(detailPaths); mScanEnv->DeleteLocalRef(path);

有疑点的是CallObjectMethod方法,但这个方法和堆栈中的art::JNI::FindClass不合。

进一步分析堆栈的报错头部

Abort message: 'art/runtime/thread.cc:1115] No pending exception expected: java.lang.NullPointerException: Attempt to read from field 'long com.iqoo.secure.ui.phoneoptimize.utils.ListItemInfo.appSize' on a null object reference'

从android的源码上看

art/runtime/class_linker.cc

<?prettify linenums=1719?>

mirror::Class* ClassLinker::FindClass(Thread* self, const char* descriptor,
                                      Handlemirror::ClassLoader classloader) {
  DCHECKNE(descriptor, '\0') << "descriptor is empty string";
  DCHECK(self != nullptr);
  self->AssertNoPendingException();
  if (descriptor[1] == '\0') {
    // only the descriptors of primitive types should be 1 character long, also avoid class lookup
    // for primitive classes that aren't backed by dex files.
    return FindPrimitiveClass(descriptor[0]);
  }
  const size_t hash = ComputeModifiedUtf8Hash(descriptor);
  // Find the class in the loaded classes table.
  mirror::Class klass = LookupClass(self, descriptor, hash, class_loader.Get());
  if (klass != nullptr) {
    return EnsureResolved(self, descriptor, klass);
  }

对应的1723行为报错的断言。 对应的android的文档是这样的解释You must not call most JNI functions while an exception is pending. 可见是调用jni的函数时有未处理的exception导致的,这个未处理的exception应该就是java.lang.NullPointerException: Attempt to read from field 'long com.iqoo.secure.ui.phoneoptimize.utils.ListItemInfo.appSize' on a null object reference


Copyright © FengGuangtu 2017