Description
After updating to RN 66.4 (might be unrelated), random crash happens on startup on Android. Works fine on iOS.
This is very similar of https://github.com/craftzdog/react-native-quick-base64/issues/2
I'm using Hermes, and these JSI Modules: MMKV, Reanimated.
I tried the same fix, setting QuickMd5Module
to public and adding a public static method install
QuickMd5Module.java
public class QuickMd5Module extends ReactContextBaseJavaModule {
static {
System.loadLibrary("quickmd5");
}
private static native void initialize(long jsiPtr, String docDir);
private static native void destruct();
public QuickMd5Module(ReactApplicationContext reactContext) {
super(reactContext);
}
@NonNull
@Override
public String getName() {
return "QuickMd5";
}
public static void install(JavaScriptContextHolder jsContext, String storageDirectory) {
initialize(jsContext.get(), storageDirectory);
}
@Override
public void onCatalystInstanceDestroy() {
QuickMd5Module.destruct();
}
}
And initialize it right after Mmkv
public class ExploreAppJSIPackage extends ReanimatedJSIModulePackage {
@Override
public List<JSIModuleSpec> getJSIModules(ReactApplicationContext reactApplicationContext, JavaScriptContextHolder jsContext) {
MmkvModule.install(jsContext, reactApplicationContext.getFilesDir().getAbsolutePath() + "/mmkv");
QuickMd5Module.install(jsContext, reactApplicationContext.getFilesDir().getAbsolutePath());
return super.getJSIModules(reactApplicationContext, jsContext);
}
It works, but I'm not sure if it is the right approach. Maybe it is better to chain inheritance of JSIModulePackage
?
react-native-quick-md5 Version
1.0.3
Crash log
SIGSEGV
Build fingerprint: 'HUAWEI/ELE-L29EEA/HWELE:10/HUAWEIELE-L29/10.1.0.150C431:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2022-01-06 12:58:36+0100
pid: 23409, tid: 23455, name: mqt_native_modu >>> fr.pilotelevage.exploreapp.dev <<<
uid: 11450
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xc
Cause: null pointer dereference
x0 000000000000000b x1 0000006ecbf1a240 x2 0000000000000001 x3 0000006ecabf0660
x4 0000006ecabf0660 x5 0000006ecabf06f8 x6 0000006ecabf0660 x7 0000006ecabf0660
x8 0000006ec83e1e10 x9 0000000000000002 x10 0000000000000000 x11 00000000fffe000e
x12 0000000000000007 x13 0000000000000001 x14 000000001fffffff x15 000000001ffffffe
x16 0000000000000003 x17 000000000000004b x18 0000006eca820000 x19 0000006ecabf0660
x20 0000006ecbcf9990 x21 0000006ecbf1a240 x22 0000006ecbf1a250 x23 000000000000004b
x24 0000006ecabf3020 x25 0000000000000001 x26 0000006ecabf06e0 x27 0000006ecabf0660
x28 0000006ecabf3020 x29 0000006ecabf0630
sp 0000006ecabf05e0 lr 0000006edaa6473c pc 0000006edaa64758
backtrace
backtrace:
#00 pc 0000000000064758 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes.so (BuildId: eddee6deb8a97571592812907782e8a8e580c0c8)
#01 pc 00000000000345b0 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes.so (BuildId: eddee6deb8a97571592812907782e8a8e580c0c8)
#02 pc 000000000007654c /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes.so (BuildId: eddee6deb8a97571592812907782e8a8e580c0c8)
#03 pc 000000000002fbb8 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes.so (BuildId: eddee6deb8a97571592812907782e8a8e580c0c8)
#04 pc 00000000000267b0 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes.so (BuildId: eddee6deb8a97571592812907782e8a8e580c0c8)
#05 pc 0000000000019388 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes-executor-common-release.so (facebook::jsi::RuntimeDecorator<facebook::jsi::Runtime, facebook::jsi::Runtime>::createFunctionFromHostFunction(facebook::jsi::PropNameID const&, unsigned int, std::__ndk1::function<facebook::jsi::Value (facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)>)+336) (BuildId: 7caed4522e7310108f9e74bcb208e2a45dc8a6b9)
#06 pc 00000000000187f0 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libhermes-executor-common-release.so (BuildId: 7caed4522e7310108f9e74bcb208e2a45dc8a6b9)
#07 pc 000000000004c728 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libquickmd5.so (installMd5(facebook::jsi::Runtime&)+184) (BuildId: f684c9a23245ae5864d7eaebbdc3017919b7e9ee)
#08 pc 000000000004ed0c /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/lib/arm64/libquickmd5.so (Java_com_reactnativequickmd5_QuickMd5Module_initialize+32) (BuildId: f684c9a23245ae5864d7eaebbdc3017919b7e9ee)
#09 pc 0000000000029ed4 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.odex (art_jni_trampoline+180)
#10 pc 00000000001455b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#11 pc 00000000001541c4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+284) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#12 pc 00000000002efe68 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#13 pc 00000000002eb138 /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) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#14 pc 00000000005c3ec4 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+368) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#15 pc 000000000013f994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#16 pc 00000000003c3006 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.reactnativequickmd5.QuickMd5Module.initialize+54)
#17 pc 00000000005c2e1c /apex/com.android.runtime/lib64/libart.so (MterpInvokeInterface+1752) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#18 pc 000000000013fa14 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_interface+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#19 pc 00000000002ef768 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.facebook.react.bridge.ModuleHolder.doInitialize+92)
#20 pc 00000000005c39b8 /apex/com.android.runtime/lib64/libart.so (MterpInvokeDirect+1168) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#21 pc 000000000013f914 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_direct+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#22 pc 00000000002ef84e /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.facebook.react.bridge.ModuleHolder.markInitializable+50)
#23 pc 00000000005c7834 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtualQuick+1368) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#24 pc 0000000000143594 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual_quick+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#25 pc 00000000002eff6e /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.facebook.react.bridge.NativeModuleRegistry.notifyJSInstanceInitialized+82)
#26 pc 00000000005c7834 /apex/com.android.runtime/lib64/libart.so (MterpInvokeVirtualQuick+1368) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#27 pc 0000000000143594 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_virtual_quick+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#28 pc 00000000002ea328 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.facebook.react.bridge.CatalystInstanceImpl$2.run+12)
#29 pc 00000000002c0988 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.10666712087520032524+320) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#30 pc 00000000005b2030 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#31 pc 000000000014e468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#32 pc 00000000008902fc /system/framework/arm64/boot-framework.oat (android.os.Handler.dispatchMessage+76) (BuildId: acc2776f7433aa810f2e0b2d5361eeaf578cd2e9)
#33 pc 0000000000145334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#34 pc 00000000001541a4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+252) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#35 pc 00000000002efe68 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#36 pc 00000000002eb138 /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) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#37 pc 00000000005c1fb4 /apex/com.android.runtime/lib64/libart.so (MterpInvokeSuper+1532) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#38 pc 000000000013f894 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_super+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#39 pc 00000000002f3b74 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage)
#40 pc 00000000002c0988 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.10666712087520032524+320) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#41 pc 00000000005b2030 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#42 pc 000000000014e468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#43 pc 00000000008939d8 /system/framework/arm64/boot-framework.oat (android.os.Looper.loop+1512) (BuildId: acc2776f7433aa810f2e0b2d5361eeaf578cd2e9)
#44 pc 00000000001455b8 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_static_stub+568) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#45 pc 00000000001541c4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+284) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#46 pc 00000000002efe68 /apex/com.android.runtime/lib64/libart.so (art::interpreter::ArtInterpreterToCompiledCodeBridge(art::Thread*, art::ArtMethod*, art::ShadowFrame*, unsigned short, art::JValue*)+384) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#47 pc 00000000002eb138 /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) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#48 pc 00000000005c3ec4 /apex/com.android.runtime/lib64/libart.so (MterpInvokeStatic+368) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#49 pc 000000000013f994 /apex/com.android.runtime/lib64/libart.so (mterp_op_invoke_static+20) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#50 pc 00000000002f3d02 /data/app/fr.pilotelevage.exploreapp.dev-6hvk-Ap-gvhm1ryUYTvcGg==/oat/arm64/base.vdex (com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run+74)
#51 pc 00000000002c0988 /apex/com.android.runtime/lib64/libart.so (_ZN3art11interpreterL7ExecuteEPNS_6ThreadERKNS_20CodeItemDataAccessorERNS_11ShadowFrameENS_6JValueEbb.llvm.10666712087520032524+320) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#52 pc 00000000005b2030 /apex/com.android.runtime/lib64/libart.so (artQuickToInterpreterBridge+1012) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#53 pc 000000000014e468 /apex/com.android.runtime/lib64/libart.so (art_quick_to_interpreter_bridge+88) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#54 pc 0000000000217fc8 /system/framework/arm64/boot.oat (java.lang.Thread.run+72) (BuildId: 98726add5977aa1e5df02f40f7b71a9584dc0b72)
#55 pc 0000000000145334 /apex/com.android.runtime/lib64/libart.so (art_quick_invoke_stub+548) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#56 pc 00000000001541a4 /apex/com.android.runtime/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+252) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#57 pc 00000000004d0248 /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) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#58 pc 00000000004d12dc /apex/com.android.runtime/lib64/libart.so (art::InvokeVirtualOrInterfaceWithJValues(art::ScopedObjectAccessAlreadyRunnable const&, _jobject*, _jmethodID*, jvalue const*)+416) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#59 pc 0000000000513bc8 /apex/com.android.runtime/lib64/libart.so (art::Thread::CreateCallback(void*)+1176) (BuildId: 1a0029abc6bafe71a123b0b3c1a098a0)
#60 pc 00000000000cf700 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+36) (BuildId: 0f53a45090c371e49b6824269190f1fa)
#61 pc 00000000000720e8 /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 0f53a45090c371e49b6824269190f1fa)