ammarahm-ed / react-native-mmkv-storage

An ultra fast (0.0002s read/write), small & encrypted mobile key-value storage framework for React Native written in C++ using JSI
https://rnmmkv.now.sh
MIT License
1.59k stars 111 forks source link

[Bug] Lot of native app crashes #271

Closed arjun1194 closed 2 years ago

arjun1194 commented 2 years ago

Describe the bug App crashes in production

To Reproduce Steps to reproduce the behavior: see crash logs

Expected behavior App should not crash

Screenshots If applicable, add screenshots to help explain your problem.

Platform Information:

Additional context

2022-07-21 14:17:59.773 13957-14594/biz.anar A/biz.anar: runtime.cc:669]   native: #33 pc 00000000003de320  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+804)
    runtime.cc:669]   native: #34 pc 0000000000757de0  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+980)
    runtime.cc:669]   native: #35 pc 0000000000203994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20)
    runtime.cc:669]   native: #36 pc 000000000044d4c0  /system/framework/framework.jar (offset 98b000) (android.os.Looper.loop+152)
    runtime.cc:669]   native: #37 pc 0000000000758274  /apex/com.android.art/lib64/libart.so (MterpInvokeStatic+2152)
    runtime.cc:669]   native: #38 pc 0000000000203994  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_static+20)
    runtime.cc:669]   native: #39 pc 00000000001a82e6  [anon:dalvik-classes30.dex extracted in memory from /data/app/~~pLY0LZ1RQaHL8Rojn9URRA==/biz.anar-JFDFs47f-SXrgoFRnDoTJA==/base.apk!classes30.dex] (com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run+74)
    runtime.cc:669]   native: #40 pc 00000000003d6150  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+304)
    runtime.cc:669]   native: #41 pc 00000000003dd890  /apex/com.android.art/lib64/libart.so (art::interpreter::ArtInterpreterToInterpreterBridge(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame*, art::JValue*)+204)
    runtime.cc:669]   native: #42 pc 00000000003de2fc  /apex/com.android.art/lib64/libart.so (bool art::interpreter::DoCall<false, false>(art::ArtMethod*, art::Thread*, art::ShadowFrame&, art::Instruction const*, unsigned short, art::JValue*)+768)
    runtime.cc:669]   native: #43 pc 0000000000752fc4  /apex/com.android.art/lib64/libart.so (MterpInvokeInterface+1568)
    runtime.cc:669]   native: #44 pc 0000000000203a14  /apex/com.android.art/lib64/libart.so (mterp_op_invoke_interface+20)
    runtime.cc:669]   native: #45 pc 00000000000eda70  /apex/com.android.art/javalib/core-oj.jar (java.lang.Thread.run+8)
    runtime.cc:669]   native: #46 pc 00000000003d6150  /apex/com.android.art/lib64/libart.so (art::interpreter::Execute(art::Thread*, art::CodeItemDataAccessor const&, art::ShadowFrame&, art::JValue, bool, bool)+304)
    runtime.cc:669]   native: #47 pc 000000000073b6b8  /apex/com.android.art/lib64/libart.so (artQuickToInterpreterBridge+776)
    runtime.cc:669]   native: #48 pc 0000000000222378  /apex/com.android.art/lib64/libart.so (art_quick_to_interpreter_bridge+88)
    runtime.cc:669]   native: #49 pc 0000000000218964  /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+548)
    runtime.cc:669]   native: #50 pc 0000000000284208  /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+188)
    runtime.cc:669]   native: #51 pc 000000000061fb98  /apex/com.android.art/lib64/libart.so (art::JValue art::InvokeVirtualOrInterfaceWithJValues<art::ArtMethod*>(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, art::ArtMethod*, jvalue const*)+460)
    runtime.cc:669]   native: #52 pc 000000000066e75c  /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1184)
    runtime.cc:669]   native: #53 pc 00000000000b1910  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+264)
    runtime.cc:669]   native: #54 pc 00000000000513f0  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64)
    runtime.cc:669]   at com.ammarahmed.mmkv.RNMMKVModule.destroy(Native method)
    runtime.cc:669]   at com.ammarahmed.mmkv.RNMMKVModule.onCatalystInstanceDestroy(RNMMKVModule.java:201)
    runtime.cc:669]   at com.facebook.react.bridge.BaseJavaModule.invalidate(BaseJavaModule.java:76)
    runtime.cc:669]   at com.facebook.react.bridge.ModuleHolder.destroy(ModuleHolder.java:110)
    runtime.cc:669]   - locked <0x0358a226> (a com.facebook.react.bridge.ModuleHolder)
ammarahm-ed commented 2 years ago

I think the app crashes when it is actually being closed by the user by removing from recents etc. Not while it is running.

arjun1194 commented 2 years ago

Yeah, but its still polluting the Crashlytics logs. Any resolutions ?

ammarahm-ed commented 2 years ago

@arjun1194 i will work on a fix.

For now you can remove this line which should fix the issue.

https://github.com/ammarahm-ed/react-native-mmkv-storage/blob/master/android/src/main/java/com/ammarahmed/mmkv/RNMMKVModule.java#L201

ammarahm-ed commented 2 years ago

Fixed in v0.8.0