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

React Native App Crashes Instantly When Entering Debug Mode when using NativeModules & JNI #38310

Open
Matt-Horton opened this issue Jul 12, 2023 · 4 comments
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: Triage 🔍 Newer Patch Available Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@Matt-Horton
Copy link

Description

I've created a small react-native app that uses some custom c++ code and the OpenCV library and works using the JNI and Native Modules. The app works fine however when I try to debug the react native code using the in app developer menu, my app instantly crashes and I get this error in Logcat (Full stack trace in section below):
Logcat Error Message

My custom c++ code only gets called once I hit a button in the app and this crashes out before I even get a chance to press the button, which leads me to believe it's an issue to do with debugging a react-native app when using Custom Modules and JNI.

This happens when I test on both a physical device (Samsung A40) and an emulator (Pixel 3a).

Has anyone encountered an issue like this before or may know what is causing this to happen?

Appreciate any guidance / help on this one.

React Native Version

0.72.0

Output of npx react-native info

System:
OS: Windows 10 10.0.19044
CPU: "(12) x64 AMD Ryzen 5 7600X 6-Core Processor "
Memory: 1.69 GB / 15.15 GB
Binaries:
Node:
version: 18.16.1
path: C:\Program Files\nodejs\node.EXE
Yarn: Not Found
npm:
version: 9.5.1
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: AI-222.4459.24.2221.10121639
Visual Studio:
- 17.6.33815.320 (Visual Studio Community 2022)
Languages:
Java: 11.0.19
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.0
wanted: 0.72.0
react-native-windows: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found

Steps to reproduce

  1. Create an app that uses Native Modules to call a native method which uses JNI to call a method in c++.
  2. Run the app in debug mode and open the developer menu
  3. Select "Debug" from the developer menu
  4. App instantly crashes

Snack, code example, screenshot, or link to a repository

Link to repository: https://github.com/Matt-Horton/image-processor

23-07-12 10:14:17.986 10985-11040 libc com.imageprocessor A Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 11040 (mqt_js), pid 10985 (.imageprocessor)
2023-07-12 10:14:18.590 11051-11051 DEBUG pid-11051 A Cmdline: com.imageprocessor
2023-07-12 10:14:18.590 11051-11051 DEBUG pid-11051 A pid: 10985, tid: 11040, name: mqt_js >>> com.imageprocessor <<<
2023-07-12 10:14:18.590 11051-11051 DEBUG pid-11051 A #00 pc 000000000003b7f4 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreact_render_runtimescheduler.so (facebook::react::RuntimeSchedulerBinding::createAndInstallIfNeeded(facebook::jsi::Runtime&, std::__ndk1::shared_ptrfacebook::react::RuntimeScheduler const&)+68) (BuildId: 154f261ff589aa1e)
2023-07-12 10:14:18.590 11051-11051 DEBUG pid-11051 A #1 pc 00000000002055e1 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.590 11051-11051 DEBUG pid-11051 A #2 pc 0000000000205591 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.590 11051-11051 DEBUG pid-11051 A #3 pc 0000000000205531 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #4 pc 00000000002054e1 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #5 pc 0000000000204300 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #6 pc 000000000028b3a9 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #7 pc 000000000028ad2c /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (std::__ndk1::function<void (facebook::jsi::Runtime&)>::operator()(facebook::jsi::Runtime&) const+44) (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #8 pc 000000000028ac68 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #9 pc 000000000028ac11 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #10 pc 000000000028abb1 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #11 pc 000000000028ab61 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #12 pc 0000000000289ab0 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #13 pc 00000000002b56b9 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #14 pc 00000000002b5629 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (std::__ndk1::function<void (facebook::react::JSExecutor*)>::operator()(facebook::react::JSExecutor*) const+57) (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.591 11051-11051 DEBUG pid-11051 A #15 pc 00000000002b55e6 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #16 pc 00000000002b556c /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #17 pc 00000000002b551c /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #18 pc 00000000002b54ec /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #19 pc 00000000002b43b8 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #20 pc 00000000003e56d1 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libhermes_executor.so (BuildId: 53166c965b19a311)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #21 pc 00000000003e5694 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libhermes_executor.so (std::__ndk1::function<void ()>::operator()() const+20) (BuildId: 53166c965b19a311)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #22 pc 00000000002153c4 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #23 pc 000000000021533c /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #24 pc 00000000002152ec /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #25 pc 00000000002152bc /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.592 11051-11051 DEBUG pid-11051 A #26 pc 0000000000214248 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libreactnativejni.so (BuildId: eedf0b28937d60c0)
2023-07-12 10:14:18.593 11051-11051 DEBUG pid-11051 A #27 pc 0000000000016979 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libfbjni.so (facebook::jni::detail::MethodWrapper<void (facebook::jni::JNativeRunnable::)(), &(facebook::jni::JNativeRunnable::run()), facebook::jni::JNativeRunnable, void>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject>)+25) (BuildId: 24c51b71e72aa958d98c6f3c2304d6447e26c99e)
2023-07-12 10:14:18.593 11051-11051 DEBUG pid-11051 A #28 pc 00000000000168f4 /data/app/~~iVVShjhaWAgH81QQf8xjPQ==/com.imageprocessor-JBViIjDg9OhWp4uwtsY-7Q==/lib/x86_64/libfbjni.so (facebook::jni::detail::FunctionWrapper<void ()(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject>), facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject*, void>::call(_JNIEnv*, _jobject*, void ()(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<facebook::jni::JNativeRunnable, facebook::jni::JRunnable>::JavaPart, facebook::jni::JRunnable, void>::_javaobject>))+52) (BuildId: 24c51b71e72aa958d98c6f3c2304d6447e26c99e)
---------------------------- PROCESS ENDED (10985) for package com.imageprocessor ----------------------------

@github-actions
Copy link

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.72.2. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@cortinico cortinico added the Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. label Jul 12, 2023
@vincentmegia
Copy link

Same issue with 0.72.7

@cortinico cortinico added the Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) label Nov 28, 2023
@Dineshmani3
Copy link

I am facing the same issue with react-native 0.72.1. I have even tried with 0.72.0 and then upgraded to 0.72.2. None of them works. Does anyone found a solution for this? Please let me know and it would be helpful. Thanks in advance.

@ryanstout
Copy link

I'm seeing the same issue, I also used JSI to bridge to OpenCV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: Triage 🔍 Newer Patch Available Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

5 participants