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

libmmkv.so crash #505

Closed
Leiluojun opened this issue Aug 3, 2020 · 24 comments
Closed

libmmkv.so crash #505

Leiluojun opened this issue Aug 3, 2020 · 24 comments

Comments

@Leiluojun
Copy link

backtrace:
#00 pc 00000000000213b0 /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#1 pc 000000000002162c /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#2 pc 000000000001c87c /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#3 pc 000000000001c290 /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#4 pc 000000000001b880 /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#5 pc 000000000001426c /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#6 pc 0000000000011060 /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/lib/arm64/libmmkv.so
#7 pc 00000000000d9bfc /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/oat/arm64/base.odex (offset 0xd8000) (com.tencent.mmkv.MMKV.encodeBytes [DEDUPED]+188)
#8 pc 0000000000562b88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#9 pc 00000000000d0340 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#10 pc 0000000000284bb8 /system/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+344)
#11 pc 000000000027eb74 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+948)
#12 pc 00000000005338b8 /system/lib64/libart.so (MterpInvokeDirect+296)
#13 pc 0000000000555394 /system/lib64/libart.so (ExecuteMterpImpl+14484)
#14 pc 00000000005408e0 /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/oat/arm64/base.vdex (com.tencent.mmkv.MMKV.a+280)
#15 pc 0000000000258670 /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2206941876)+496)
#16 pc 000000000025e1f0 /system/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+216)
#17 pc 000000000027eb58 /system/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+920)
#18 pc 00000000005355c8 /system/lib64/libart.so (MterpInvokeVirtualQuick+584)
#19 pc 0000000000559014 /system/lib64/libart.so (ExecuteMterpImpl+29972)
#20 pc 0000000000529586 /data/app/com.ss.android.videos.ll-vdwLW3LOiZNU9YkDNxAvfQ==/oat/arm64/base.vdex (com.lenovo.anyshare.adu$1.run+106)
#21 pc 0000000000258670 /system/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool) (.llvm.2206941876)+496)
#22 pc 0000000000521f90 /system/lib64/libart.so (artQuickToInterpreterBridge+1032)
#23 pc 000000000056bcfc /system/lib64/libart.so (art_quick_to_interpreter_bridge+92)
#24 pc 0000000000bcf4c4 /system/framework/arm64/boot.oat (offset 0x2dc000) (java.util.concurrent.ThreadPoolExecutor.runWorker+996)
#25 pc 0000000000bcc230 /system/framework/arm64/boot.oat (offset 0x2dc000) (java.util.concurrent.ThreadPoolExecutor$Worker.run+64)
#26 pc 0000000000a59c58 /system/framework/arm64/boot.oat (offset 0x2dc000) (java.lang.Thread.run+72)
#27 pc 0000000000562b88 /system/lib64/libart.so (art_quick_invoke_stub+584)
#28 pc 00000000000d0340 /system/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+200)
#29 pc 0000000000466560 /system/lib64/libart.so (art::(anonymous namespace)::InvokeWithArgArray(art::ScopedObjectAccessAlreadyRunnable const&, art::ArtMethod*, art::(anonymous namespace)::ArgArray*, art::JValue*, char const*)+104)
#30 pc 0000000000467628 /system/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue*)+424)
#31 pc 00000000004946f8 /system/lib64/libart.so (art::Thread::CreateCallback(void*)+1120)
#32 pc 0000000000084d6c /system/lib64/libc.so (__pthread_start(void*)+36)
#33 pc 00000000000234cc /system/lib64/libc.so (__start_thread+68)

@lingol
Copy link
Collaborator

lingol commented Aug 3, 2020

Please follow the issue template, provide detailed info such as platform, version of MMKV, detailed crash stacks, logs of MMKV, etc.

@Leiluojun
Copy link
Author

platform:Android
version:1.2.1
Most crashes occurred on Android 9.0 devices

@lishuoyan
Copy link

我也遇到这样的问题。
在android 9.0和10.0上。
mmkv是1.2.1版本。
红米和oppo都有报。

@lingol
Copy link
Collaborator

lingol commented Aug 3, 2020

mmkv::CodedOutputData::writeRawByte(unsigned char)
/Users/lingol/Developer/mmkv/Core/CodedOutputData.cpp:118
mmkv::CodedOutputData::writeRawVarint32(int)
/Users/lingol/Developer/mmkv/Core/CodedOutputData.cpp:135
MMKV::doAppendDataWithKey(mmkv::MMBuffer const&, mmkv::MMBuffer const&, bool, unsigned int)
/Users/lingol/Developer/mmkv/Core/MMKV_IO.cpp:656
MMKV::appendDataWithKey(mmkv::MMBuffer const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, bool)
/Users/lingol/Developer/mmkv/Core/MMKV_IO.cpp:687
MMKV::setDataForKey(mmkv::MMBuffer&&, std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, bool)
/Users/lingol/Developer/mmkv/Core/MMKV_IO.cpp:561
MMKV::set(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&)
/Users/lingol/Developer/mmkv/Core/MMKV.cpp:468
mmkv::encodeString(_JNIEnv*, _jobject*, long, _jstring*, _jstring*)
/Users/lingol/Developer/mmkv/Android/MMKV/mmkv/.cxx/cmake/StaticCppRelease/arm64-v8a/../../../../src/main/cpp/native-bridge.cpp:465

  1. Either there's not enough space on the device. In which case you can check the available space on your crash report systems.
  2. Or, you are accessing a multi-process MMKV instance with single-process mode. In which case you can upgrade to MMKV v1.2.2, you should face an exception about that.

@Leiluojun
Copy link
Author

I should upgrade to MMKV v1.2.2 and support muliti_process?

@lingol
Copy link
Collaborator

lingol commented Aug 3, 2020

I should upgrade to MMKV v1.2.2 and support muliti_process?

No. You should first check your crash report to see if there's enough space. And if yes, then you should alert users to clean up enough space to continue using your App.

And if no, then you should upgrade to v1.2.2 to check if you are mistakenly using MMKV. And if yes, you should change it to MULTI_PROCESS_MODE.

@lingol
Copy link
Collaborator

lingol commented Aug 3, 2020

MMKV itself supports multi-process accessing from the very beginning. There's no such thing as to upgrade to v1.2.2 and support multi-process.

@Leiluojun
Copy link
Author

ok thanks

@Leiluojun
Copy link
Author

I check user has enough space,It should be the cause of multiple processes
But I didn't replicate this crash in multiple processes,Is this crash an occasional occurrence?
How can I reproduce it?

@lingol
Copy link
Collaborator

lingol commented Aug 3, 2020

I check user has enough space,It should be the cause of multiple processes
But I didn't replicate this crash in multiple processes,Is this crash an occasional occurrence?
How can I reproduce it?

I believe I have told you how.

@Leiluojun
Copy link
Author

When I upgrade mmkv to 1.2.2 and support multi-process ,There have been a lot of crashes,such as:
platform:Android
mmkv:1.2.2

How should I fix it?thanks

backtrace:
#00 pc 0000000000017114 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/lib/arm64/libmmkv.so
#1 pc 00000000000188b4 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/lib/arm64/libmmkv.so
#2 pc 0000000000010470 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/lib/arm64/libmmkv.so
#3 pc 00000000001bf2cc /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.odex (art_jni_trampoline+236)
#4 pc 00000000001375b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568)
#5 pc 000000000014608c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276)
#6 pc 00000000002e0c94 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
#7 pc 00000000002dbf74 /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*)+912)
#8 pc 000000000059cc50 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+368)
#9 pc 0000000000131994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
#10 pc 00000000008e0a94 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.vdex (com.tencent.mmkv.MMKV.a+10)
#11 pc 000000000059cf50 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+1136)
#12 pc 0000000000131994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20)
#13 pc 00000000008c4de2 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.vdex (com.ss.android.videos.adt.a+34)
#14 pc 00000000002b18e0 /apex/com.android.runtime/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.18252570399552585066)+240)
#15 pc 000000000058b6ac /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012)
#16 pc 0000000000140468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
#17 pc 000000000023b5b8 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.odex (com.ss.android.videos.adm.a+88)
#18 pc 000000000023cb88 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.odex (com.ss.android.videos.ads.getSharedPreferences+648)
#19 pc 00000000002463ac /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.odex (com.ss.android.videos.bph.a+460)
#20 pc 0000000000245ec4 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.odex (com.ss.android.videos.bph.+68)
#21 pc 0000000000137334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
#22 pc 000000000014606c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
#23 pc 00000000002e0c94 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384)
#24 pc 00000000002dbf74 /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*)+912)
#25 pc 000000000059c444 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+400)
#26 pc 0000000000131914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20)
#27 pc 00000000006462da /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.vdex (com.ss.android.videos.aby.+124)
#28 pc 00000000002b18e0 /apex/com.android.runtime/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.18252570399552585066)+240)
#29 pc 000000000058b6ac /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012)
#30 pc 0000000000140468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
#31 pc 00000000001375b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568)
#32 pc 000000000014608c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+276)
#33 pc 00000000001719c8 /apex/com.android.runtime/lib64/libart.so (art::ClassLinker::InitializeClass(art::Thread*, art::Handleart::mirror::Class, bool, bool)+1920)
#34 pc 000000000015c948 /apex/com.android.runtime/lib64/libart.so (art::ClassLinker::EnsureInitialized(art::Thread*, art::Handleart::mirror::Class, bool, bool)+92)
#35 pc 00000000005a183c /apex/com.android.runtime/lib64/libart.so (MterpNewInstance+696)
#36 pc 000000000012f210 /apex/com.android.runtime/lib64/libart.so (mterp_op_new_instance+16)
#37 pc 00000000008cb848 /data/app/com.ss.android.videos.ll-PMPO4o2RmhcW4wzN0hsXkQ==/oat/arm64/base.vdex (com.ss.android.videos.byo$1.run+102)
#38 pc 00000000002b18e0 /apex/com.android.runtime/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool) (.llvm.18252570399552585066)+240)
#39 pc 000000000058b6ac /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012)
#40 pc 0000000000140468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88)
#41 pc 00000000002fa878 /system/framework/arm64/boot.oat (java.util.concurrent.ThreadPoolExecutor.runWorker+984)
#42 pc 00000000002f7ee0 /system/framework/arm64/boot.oat (java.util.concurrent.ThreadPoolExecutor$Worker.run+64)
#43 pc 00000000001a5568 /system/framework/arm64/boot.oat (java.lang.Thread.run+72)
#44 pc 0000000000137334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548)
#45 pc 000000000014606c /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+244)
#46 pc 00000000004ab6f0 /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)
#47 pc 00000000004ac784 /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416)
#48 pc 00000000004ecac4 /apex/com.android.runtime/lib64/libart.so (art::Thread::CreateCallback(void*)+1176)
#49 pc 00000000000e28c0 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36)
#50 pc 000000000008503c /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)

@lingol
Copy link
Collaborator

lingol commented Aug 8, 2020

Are you using mmkv or mmkv-static?

It crashed inside C++ standard library.

@lingol
Copy link
Collaborator

lingol commented Aug 8, 2020

std::__ndk1::__bucket_list_deallocator<std::__ndk1::allocator<std::__ndk1::__hash_node_base<std::__ndk1::__hash_node<std::__ndk1::__hash_value_type<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >, MMKV*>, void*>>> >::size() const at /Users/lingol/Library/Android/sdk/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/__hash_table:815
std::__ndk1::unordered_map<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator >, MMKV*, std::__ndk1::hash<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > >, std::__ndk1::equal_to<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > >, std::__ndk1::allocator<std::__ndk1::pair<std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const, MMKV*> > >::find(std::__ndk1::basic_string<char, std::__ndk1::char_traits, std::__ndk1::allocator > const&) at /Users/lingol/Library/Android/sdk/android-ndk-r16b/sources/cxx-stl/llvm-libc++/include/unordered_map:1102
mmkv::getMMKVWithID(_JNIEnv*, _jobject*, _jstring*, int, _jstring*, _jstring*) at /Users/lingol/Developer/mmkv/Android/MMKV/mmkv/.cxx/cmake/StaticCppRelease/arm64-v8a/../../../../src/main/cpp/native-bridge.cpp:258

Assuming you are using mmkv-static, that's the crash stacks above. It's inside C++ standard lib. I don't have any clue.

@lingol
Copy link
Collaborator

lingol commented Aug 8, 2020

Maybe you can upload a reproducible demo project.

@Leiluojun
Copy link
Author

I use 'com.tencent:mmkv-static:1.2.2'

@lingol
Copy link
Collaborator

lingol commented Aug 8, 2020

It's a dead end here.

@samlu
Copy link

samlu commented Aug 10, 2020

Off the topic, I compiled mmkv with MMKV_DISABLE_CRYPT defined. I also see some libmmkv.so crash log.
Would you show us how to generate the symbol file and get a human-readable code dump stacks?

I don't see it from the FAQ or other WiKi pages.

@lingol
Copy link
Collaborator

lingol commented Aug 10, 2020

Off the topic, I compiled mmkv with MMKV_DISABLE_CRYPT defined. I also see some libmmkv.so crash log.
Would you show us how to generate the symbol file and get a human-readable code dump stacks?

I don't see it from the FAQ or other WiKi pages.

In the beginning, I thought symbolizing crash stacks is Android-Programming-101 for Android developers. But un-symbolized crash stacks keep coming to almost all issues from Android developers. I just gave up and symbolized myself for you.

@lingol
Copy link
Collaborator

lingol commented Aug 10, 2020

In one word, Google yourself. It's not about MMKV is any kind of special. It's about symbolizing Android native call stacks.

@lingol
Copy link
Collaborator

lingol commented Aug 12, 2020

Maybe you can upload a reproducible demo project.

Can you reproduce it on a demo project? @Leiluojun

@lingol
Copy link
Collaborator

lingol commented Aug 20, 2020

Any updates yet?

@lingol
Copy link
Collaborator

lingol commented Aug 25, 2020

Close due to inactive.

@lingol lingol closed this as completed Aug 25, 2020
@Xiaomao136
Copy link

Oh, it was closed before the problem was solved, and I expressed regret.

@lingol
Copy link
Collaborator

lingol commented Dec 29, 2021

Oh, it was closed before the problem was solved, and I expressed regret.

If you can provide additional info such as a reproducible demo, you are very well welcome to create a new issue.

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

5 participants