Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ANR增加调用堆栈 #1189

Closed
lz0928 opened this issue Oct 25, 2023 · 2 comments
Closed

ANR增加调用堆栈 #1189

lz0928 opened this issue Oct 25, 2023 · 2 comments

Comments

@lz0928
Copy link

lz0928 commented Oct 25, 2023

The language of MMKV
Java

The version of MMKV
v1.3.1

The platform of MMKV
Android

The installation of MMKV
Maven

What's the issue?
MMKV.initialize(context)执行了20秒才初始化完成

下面是log
行 21821: 10-23 19:23:03.690 4025 4025 I MMKV : Disable checkProcessMode()
行 26483: 10-23 19:23:22.438 4025 4025 I MMKV : current API level = 29, libc++_shared=0
行 26487: 10-23 19:23:22.439 4025 4025 I MMKV : MMKV.cpp:164::initialize version v1.3.1, page size 4096, arch arm64-v8a
行 26489: 10-23 19:23:22.439 4025 4025 I MMKV : MMKV.cpp:175::initialize armv8 AES instructions is supported
行 26490: 10-23 19:23:22.439 4025 4025 I MMKV : MMKV.cpp:183::initialize armv8 CRC32 instructions is supported
行 26492: 10-23 19:23:22.440 4025 4025 I MMKV : MMKV.cpp:207::initializeMMKV root dir: /data/user/0/com.example.app/files/mmkv

下面是调用堆栈
native: #00 pc 00000000000868bc /apex/com.android.runtime/lib64/bionic/libc.so (syscall+28)
native: #1 pc 000000000014e1f4 /apex/com.android.runtime/lib64/libart.so (art::ConditionVariable::WaitHoldingLocks(art::Thread*)+148)
native: #2 pc 00000000003ced94 /apex/com.android.runtime/lib64/libart.so (art::JNI::GetStringUTFChars(_JNIEnv*, _jstring*, unsigned char*)+452)
native: #3 pc 0000000000045518 /system/priv-app/xxxxx/xxxxx.apk!libmmkv.so (offset 7c7000) (???)
native: #4 pc 0000000000045434 /system/priv-app/xxxxx/xxxxx.apk!libmmkv.so (offset 7c7000) (???)
native: #5 pc 000000000004215c /system/priv-app/xxxxx/xxxxx.apk!libmmkv.so (offset 7c7000) (???)
native: #6 pc 0000000000020318 /data/dalvik-cache/arm64/system@priv-app@xxxxx@xxxxx.apk@classes.dex (art_jni_trampoline+216)
native: #7 pc 00000000001395b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568)
native: #8 pc 000000000014800c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276)
native: #9 pc 00000000002eccc0 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
native: #10 pc 00000000002e7f20 /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892)
native: #11 pc 00000000005ae178 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+372)
native: #12 pc 0000000000133994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
native: #13 pc 00000000002174fa /system/priv-app/xxxxx/xxxxx.apk (com.tencent.mmkv.MMKV.c+170)
native: #14 pc 00000000002bdfd4 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.399316094552197814+240)
native: #15 pc 000000000059cc0c /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032)
native: #16 pc 0000000000142468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
native: #17 pc 00000000001395b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568)
native: #18 pc 000000000014800c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276)
native: #19 pc 00000000002eccc0 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
native: #20 pc 00000000002e7f20 /apex/com.android.runtime/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+892)
native: #21 pc 00000000005ae178 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+372)
native: #22 pc 0000000000133994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
native: #23 pc 00000000001e7b18 /system/priv-app/xxxxx/xxxxx.apk (d.f.g.p.c.a+976)
native: #24 pc 00000000005ab964 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352)
native: #25 pc 0000000000133814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20)
native: #26 pc 00000000001e8370 /system/priv-app/xxxxx/xxxxx.apk (d.f.g.p.f.a+208)
native: #27 pc 00000000005ab964 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352)
native: #28 pc 0000000000133814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20)
native: #29 pc 00000000001e8194 /system/priv-app/xxxxx/xxxxx.apk (d.f.g.p.g.m+128)
native: #30 pc 00000000005ab964 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352)
native: #31 pc 0000000000133814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20)
native: #32 pc 000000000022dc96 /system/priv-app/xxxxx/xxxxx.apk (f.r.j.a.a.g+26)
native: #33 pc 00000000005ad184 /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1788)
native: #34 pc 0000000000133a14 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_interface+20)
native: #35 pc 00000000002cf7a4 /system/priv-app/xxxxx/xxxxx.apk (g.a.f0.run+172)
native: #36 pc 00000000005ad184 /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1788)
native: #37 pc 0000000000133a14 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_interface+20)
native: #38 pc 00000000002cfdf4 /system/priv-app/xxxxx/xxxxx.apk (g.a.l0.v+256)
native: #39 pc 00000000005ab964 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtual+1352)
native: #40 pc 0000000000133814 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual+20)
native: #41 pc 00000000002c64c4 /system/priv-app/xxxxx/xxxxx.apk (f.x.v.b.c1.n.a2.c.p0+144)
native: #42 pc 00000000005ae414 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+1040)
native: #43 pc 0000000000133994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
native: #44 pc 00000000001bd842 /system/priv-app/xxxxx/xxxxx.apk (com.example.app..App.onCreate+170)
native: #45 pc 00000000002bdfd4 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.399316094552197814+240)
native: #46 pc 000000000059cc0c /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1032)
native: #47 pc 0000000000142468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
native: #48 pc 00000000003e1b54 /system/framework/arm64/boot-framework.oat (android.app.Instrumentation.callApplicationOnCreate+52)
native: #49 pc 00000000004d3dcc /system/framework/arm64/boot-framework.oat (android.app.ActivityThread.handleBindApplication+7724)
native: #50 pc 00000000004be33c /system/framework/arm64/boot-framework.oat (android.app.ActivityThread$H.handleMessage+7004)
native: #51 pc 0000000000741ad4 /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+180)
native: #52 pc 0000000000745190 /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+1504)
native: #53 pc 00000000004cbc9c /system/framework/arm64/boot-framework.oat (android.app.ActivityThread.main+764)
native: #54 pc 00000000001395b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568)
native: #55 pc 000000000014800c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276)
native: #56 pc 00000000004bb5d8 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
native: #57 pc 00000000004bd17c /apex/com.android.runtime/lib64/libart.so (art::InvokeMethod(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jobject*, _jobject*, unsigned long)+1480)
native: #58 pc 0000000000448410 /apex/com.android.runtime/lib64/libart.so (art::Method_invoke(_JNIEnv*, _jobject*, _jobject*, _jobjectArray*)+52)
native: #59 pc 00000000000c2c34 /system/framework/arm64/boot.oat (art_jni_trampoline+180)
native: #60 pc 00000000009bdae8 /system/framework/arm64/boot-framework.oat (com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run+136)
native: #61 pc 00000000009c58c4 /system/framework/arm64/boot-framework.oat (com.android.internal.os.ZygoteInit.main+2084)
native: #62 pc 00000000001395b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568)
native: #63 pc 000000000014800c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276)
native: #64 pc 00000000004bb5d8 /apex/com.android.runtime/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
native: #65 pc 00000000004bb1c8 /apex/com.android.runtime/lib64/libart.so (art::InvokeWithVarArgs(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, std::__va_list)+408)
native: #66 pc 00000000003c4b84 /apex/com.android.runtime/lib64/libart.so (art::JNI::CallStaticVoidMethodV(_JNIEnv*, _jclass*, _jmethodID*, std::__va_list)+624)
native: #67 pc 00000000000c2a6c /system/lib64/libandroid_runtime.so (_JNIEnv::CallStaticVoidMethod(_jclass*, _jmethodID*, ...)+116)
native: #68 pc 00000000000c5948 /system/lib64/libandroid_runtime.so (android::AndroidRuntime::start(char const*, android::Vectorandroid::String8 const&, bool)+776)
native: #69 pc 00000000000035b0 /system/bin/app_process64 (main+1376)
native: #70 pc 0000000000084e18 /apex/com.android.runtime/lib64/bionic/libc.so (__libc_init+108)
at com.tencent.mmkv.MMKV.jniInitialize(Native method)
at com.tencent.mmkv.MMKV.c(:5)

@lingol
Copy link
Collaborator

lingol commented Oct 26, 2023

Please provide symbolized call stacks of MMKV, otherwise, it's meanless.

@lingol
Copy link
Collaborator

lingol commented Oct 26, 2023

And you should provide the details of your ANR profiling, such as flame graphs.

@lingol lingol closed this as completed Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants