процесс приложения заблокирован на art :: ConditionVariable :: WaitHoldingLocks, как найти причину? - PullRequest
0 голосов
/ 26 марта 2020

На Android 8.0, разработано с kotlin и kotlin сопрограммой. Все темы будут заблокированы в приложении. Я проанализировал с помощью strace, gdbserver, чтобы проверить системный вызов и получить кучу. такая куча как: куча первого потока из gdb

#0  0x0000007022ab84ac in syscall () from target:/system/lib64/libc.so
#1  0x0000006fa00a1640 in art::ConditionVariable::WaitHoldingLocks(art::Thread*) ()
   from target:/system/lib64/libart.so
#2  0x0000006fa01f0ac0 in art::gc::ReferenceProcessor::GetReferent(art::Thread*, art::ObjPtr<art::mirror::Reference>) () from target:/system/lib64/libart.so
#3  0x0000006fa03a31fc in art::Reference_getReferent(_JNIEnv*, _jobject*) ()
   from target:/system/lib64/libart.so
#4  0x0000000070f422b0 in java.lang.Object.internalClone [DEDUPED] ()
   from target:/system/framework/arm64/boot.oat
#5  0x0000000070f97d5c in java.lang.ref.Reference.get () from target:/system/framework/arm64/boot.oat
#6  0x0000000070fd30ec in java.lang.ThreadLocal.get () from target:/system/framework/arm64/boot.oat
#7  0x000000007183b764 in dalvik.system.BlockGuard.getThreadPolicy ()
   from target:/system/framework/arm64/boot-core-libart.oat
#8  0x0000000072a54578 in android.os.StrictMode.setBlockGuardPolicy ()
   from target:/system/framework/arm64/boot-framework.oat
#9  0x0000000072a52fc8 in android.os.StrictMode.onBinderStrictModePolicyChange ()
   from target:/system/framework/arm64/boot-framework.oat
#10 0x0000006fa0505e50 in art_quick_invoke_static_stub () from target:/system/lib64/libart.so
#11 0x0000006fa00975d4 in art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) () from target:/system/lib64/libart.so
#12 0x0000006fa0429dcc in art::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::ArgArray*, art::JValue*, char const*) () from target:/system/lib64/libart.so
#13 0x0000006fa04299f0 in art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list) () from target:/system/lib64/libart.so
#14 0x0000006fa033042c in art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list) () from target:/system/lib64/libart.so
#15 0x000000702114ae00 in _JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...) ()
   from target:/system/lib64/libandroid_runtime.so
#16 0x00000070211b4b74 in android::android_os_Parcel_enforceInterface(_JNIEnv*, _jclass*, long, _jstring*) () from target:/system/lib64/libandroid_runtime.so
#17 0x00000000723549b8 in android.app.admin.SecurityLog.readEventsOnWrapping [DEDUPED] ()
   from target:/system/framework/arm64/boot-framework.oat
#18 0x00000000996e72e0 in ?? ()
Backtrace stopped: Cannot access memory at address 0x8000000000000018

или куча второго потока из gdb

#0  0x0000007022ab84ac in syscall () from target:/system/lib64/libc.so
#1  0x0000006fa00a1640 in art::ConditionVariable::WaitHoldingLocks(art::Thread*) ()
   from target:/system/lib64/libart.so
#2  0x0000006fa01f0ac0 in art::gc::ReferenceProcessor::GetReferent(art::Thread*, art::ObjPtr<art::mirror::Reference>) () from target:/system/lib64/libart.so
#3  0x0000006fa03a31fc in art::Reference_getReferent(_JNIEnv*, _jobject*) ()
   from target:/system/lib64/libart.so
#4  0x0000000070f422b0 in java.lang.Object.internalClone [DEDUPED] ()
   from target:/system/framework/arm64/boot.oat
#5  0x0000000070f97d5c in java.lang.ref.Reference.get ()
   from target:/system/framework/arm64/boot.oat
#6  0x0000000070fd30ec in java.lang.ThreadLocal.get () from target:/system/framework/arm64/boot.oat
#7  0x000000007141eba4 in sun.misc.FloatingDecimal.getBinaryToASCIIConverter ()
   from target:/system/framework/arm64/boot.oat
#8  0x0000000071423c30 in sun.misc.FormattedFloatingDecimal.valueOf ()
   from target:/system/framework/arm64/boot.oat
#9  0x0000006fa0505e50 in art_quick_invoke_static_stub () from target:/system/lib64/libart.so
#10 0x0000006fa00975d4 in art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*) () from target:/system/lib64/libart.so
#11 0x0000006fa02564a0 in art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*) () from target:/system/lib64/libart.so
#12 0x0000006fa0250a94 in bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*) ()
   from target:/system/lib64/libart.so
#13 0x0000006fa04eef54 in MterpInvokeStatic () from target:/system/lib64/libart.so
---Type <return> to continue, or q <return> to quit---
#14 0x0000006fa04f7a98 in artMterpAsmInstructionStart () from target:/system/lib64/libart.so
#15 0x0000006fa0230c04 in art::interpreter::Execute(art::Thread*, art::DexFile::CodeItem const*, art::ShadowFrame&, art::JValue, bool) () from target:/system/lib64/libart.so
#16 0x0000006fa04e0454 in artQuickToInterpreterBridge () from target:/system/lib64/libart.so
#17 0x0000006fa050ed10 in art_quick_to_interpreter_bridge () from target:/system/lib64/libart.so
#18 0x00000000711fa340 in java.util.Formatter$FormatSpecifier.print ()
   from target:/system/framework/arm64/boot.oat
#19 0x00000000711feb1c in java.util.Formatter$FormatSpecifier.printFloat ()
   from target:/system/framework/arm64/boot.oat
#20 0x00000000711ffebc in java.util.Formatter$FormatSpecifier.print ()
   from target:/system/framework/arm64/boot.oat
#21 0x0000000071206bcc in java.util.Formatter.format () from target:/system/framework/arm64/boot.oat

или куча 3-го потока из gdb

#0  0x0000007022ab84ac in syscall () from target:/system/lib64/libc.so
#1  0x0000006fa00a1640 in art::ConditionVariable::WaitHoldingLocks(art::Thread*) ()
   from target:/system/lib64/libart.so
#2  0x0000006fa01cdcc4 in art::gc::Heap::WaitForGcToCompleteLocked(art::gc::GcCause, art::Thread*) ()
   from target:/system/lib64/libart.so
#3  0x0000006fa01da6f4 in art::gc::Heap::WaitForGcToComplete(art::gc::GcCause, art::Thread*) ()
   from target:/system/lib64/libart.so
#4  0x0000006fa01d6b6c in art::gc::Heap::AllocateInternalWithGc(art::Thread*, art::gc::AllocatorType, bool, unsigned long, unsigned long*, unsigned long*, unsigned long*, art::ObjPtr<art::mirror::Class>*)
    () from target:/system/lib64/libart.so
#5  0x0000006fa04d1a94 in artAllocObjectFromCodeInitializedRegionTLAB ()
   from target:/system/lib64/libart.so
#6  0x0000006fa050d880 in art_quick_alloc_object_initialized_region_tlab ()
   from target:/system/lib64/libart.so
#7  0x00000000996983f8 in ?? ()
#8  0x0000006f87911e83 in ?? ()
#9  0x8763de0146466cfb in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

эти три кучи из разных потоков. Теперь процесс моего приложения заблокирован. Как я могу проанализировать причину?

...