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

Android Crash: Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT) - Thread Safety issue #2590

Open
StanislavDHH opened this issue Aug 24, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@StanislavDHH
Copy link

Description

I am experiencing a crash on Android devices when launching my app, which integrates Skia (through the Skottie animation library).

The crash occurs consistently, and based on my debugging, it seems to involve a conflict or issue between Skia's rendering and Instabug's integration, although I have not been able to pinpoint the exact cause in stacktrase. The crash traces back to methods in the Skia rendering pipeline, particularly related to RNSkia::RNSkPlatformContext::notifyDrawLoop and interactions with the JSI runtime.
I've tried to solve the thread safety issue by ensuring it runs on appropriate thread, but didn't succeed.

Environment
Android 14 (both physical and emulators), react-native 0.74.x, react-native-skia (latest), react-native-skottie (latest), instabug-reactnative 13.2.0

Crash log attached:
skia_crash.log

I would appreciate any help! Thank you!

Version

1.3.11

Steps to reproduce

  1. Create a bare React Native project.
  2. Integrate Skottie for loading animations within the app.
  3. Install and configure Instabug.
  4. Launch the app on any Android device.

Upon launching the app, it crashes consistently. The issue appears to be tied to the interaction between Skia and Instabug, potentially during the rendering process managed by Skia.

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

To pinpoint the root cause I've built the app with debugger enabled, and it ended up in Hermes trap:

Image

Image
1:

[libhermes_executor.so] facebook::react::ReentrancyCheck::before() HermesExecutorFactory.cpp:109
[libhermes_executor.so] facebook::jsi::detail::BeforeCaller::before(facebook::react::ReentrancyCheck &) decorator.h:468
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::Around::Around(facebook::react::ReentrancyCheck &) decorator.h:804
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::call(const facebook::jsi::Function &, const facebook::jsi::Value &, const facebook::jsi::Value *, unsigned long) decorator.h:763
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, const facebook::jsi::Value *, unsigned long) const jsi-inl.h:264
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, std::initializer_list<…>) const jsi-inl.h:269
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call<…>(facebook::jsi::Runtime &, facebook::jsi::Value &&) const jsi-inl.h:277
[librnskia.so] RNSkia::RNSkPlatformContext::notifyDrawLoop(bool) RNSkPlatformContext.h:243
[librnskia.so] <lambda>::operator()() const RNSkAndroidPlatformContext.h:38
[libreactnativejni.so] std::__ndk1::__function::__value_func::operator()[abi:v170000]() const Function.h:510
[libreactnativejni.so] std::__ndk1::function::operator()() const Function.h:1156
[librnskia.so] RNSkia::JniPlatformContext::notifyDrawLoopExternal() JniPlatformContext.cpp:155
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniPlatformContext, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>) Registration-inl.h:129
[librnskia.so] facebook::jni::detail::CallWithJniConversions::call(facebook::jni::detail::JTypeFor<…>::_javaobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:66
[librnskia.so] facebook::jni::detail::FunctionWrapper::call(_JNIEnv *, _jobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:95
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::call(_JNIEnv*, _jobject*) Registration-inl.h:138
[libhermes_executor.so] facebook::react::ReentrancyCheck::before() HermesExecutorFactory.cpp:109
[libhermes_executor.so] facebook::jsi::detail::BeforeCaller::before(facebook::react::ReentrancyCheck &) decorator.h:468
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::Around::Around(facebook::react::ReentrancyCheck &) decorator.h:804
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::call(const facebook::jsi::Function &, const facebook::jsi::Value &, const facebook::jsi::Value *, unsigned long) decorator.h:763
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, const facebook::jsi::Value *, unsigned long) const jsi-inl.h:264
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, std::initializer_list<…>) const jsi-inl.h:269
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call<…>(facebook::jsi::Runtime &, facebook::jsi::Value &&) const jsi-inl.h:277
[librnskia.so] RNSkia::RNSkPlatformContext::notifyDrawLoop(bool) RNSkPlatformContext.h:243
[librnskia.so] <lambda>::operator()() const RNSkAndroidPlatformContext.h:38
[libreactnativejni.so] std::__ndk1::__function::__value_func::operator()[abi:v170000]() const Function.h:510
[libreactnativejni.so] std::__ndk1::function::operator()() const Function.h:1156
[librnskia.so] RNSkia::JniPlatformContext::notifyDrawLoopExternal() JniPlatformContext.cpp:155
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniPlatformContext, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>) Registration-inl.h:129
[librnskia.so] facebook::jni::detail::CallWithJniConversions::call(facebook::jni::detail::JTypeFor<…>::_javaobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:66
[librnskia.so] facebook::jni::detail::FunctionWrapper::call(_JNIEnv *, _jobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:95
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::call(_JNIEnv*, _jobject*) Registration-inl.h:138
[libhermes_executor.so] facebook::react::ReentrancyCheck::before() HermesExecutorFactory.cpp:109
[libhermes_executor.so] facebook::jsi::detail::BeforeCaller::before(facebook::react::ReentrancyCheck &) decorator.h:468
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::Around::Around(facebook::react::ReentrancyCheck &) decorator.h:804
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::call(const facebook::jsi::Function &, const facebook::jsi::Value &, const facebook::jsi::Value *, unsigned long) decorator.h:763
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, const facebook::jsi::Value *, unsigned long) const jsi-inl.h:264
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, std::initializer_list<…>) const jsi-inl.h:269
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call<…>(facebook::jsi::Runtime &, facebook::jsi::Value &&) const jsi-inl.h:277
[librnskia.so] RNSkia::RNSkPlatformContext::notifyDrawLoop(bool) RNSkPlatformContext.h:243
[librnskia.so] <lambda>::operator()() const RNSkAndroidPlatformContext.h:38
[libreactnativejni.so] std::__ndk1::__function::__value_func::operator()[abi:v170000]() const Function.h:510
[libreactnativejni.so] std::__ndk1::function::operator()() const Function.h:1156
[librnskia.so] RNSkia::JniPlatformContext::notifyDrawLoopExternal() JniPlatformContext.cpp:155
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniPlatformContext, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>) Registration-inl.h:129
[librnskia.so] facebook::jni::detail::CallWithJniConversions::call(facebook::jni::detail::JTypeFor<…>::_javaobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:66
[librnskia.so] facebook::jni::detail::FunctionWrapper::call(_JNIEnv *, _jobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:95
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::call(_JNIEnv*, _jobject*) Registration-inl.h:138
[libhermes_executor.so] facebook::react::ReentrancyCheck::before() HermesExecutorFactory.cpp:109
[libhermes_executor.so] facebook::jsi::detail::BeforeCaller::before(facebook::react::ReentrancyCheck &) decorator.h:468
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::Around::Around(facebook::react::ReentrancyCheck &) decorator.h:804
[libhermes_executor.so] facebook::jsi::WithRuntimeDecorator::call(const facebook::jsi::Function &, const facebook::jsi::Value &, const facebook::jsi::Value *, unsigned long) decorator.h:763
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, const facebook::jsi::Value *, unsigned long) const jsi-inl.h:264
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call(facebook::jsi::Runtime &, std::initializer_list<…>) const jsi-inl.h:269
[Inlined] [libreact-native-skottie.so] facebook::jsi::Function::call<…>(facebook::jsi::Runtime &, facebook::jsi::Value &&) const jsi-inl.h:277
[librnskia.so] RNSkia::RNSkPlatformContext::notifyDrawLoop(bool) RNSkPlatformContext.h:243
[librnskia.so] <lambda>::operator()() const RNSkAndroidPlatformContext.h:38
[libreactnativejni.so] std::__ndk1::__function::__value_func::operator()[abi:v170000]() const Function.h:510
[libreactnativejni.so] std::__ndk1::function::operator()() const Function.h:1156
[librnskia.so] RNSkia::JniPlatformContext::notifyDrawLoopExternal() JniPlatformContext.cpp:155
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::dispatch(facebook::jni::alias_ref<facebook::jni::detail::JTypeFor<facebook::jni::HybridClass<RNSkia::JniPlatformContext, facebook::jni::detail::BaseHybridClass>::JavaPart, facebook::jni::JObject, void>::_javaobject*>) Registration-inl.h:129
[librnskia.so] facebook::jni::detail::CallWithJniConversions::call(facebook::jni::detail::JTypeFor<…>::_javaobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:66
[librnskia.so] facebook::jni::detail::FunctionWrapper::call(_JNIEnv *, _jobject *, void (*)(facebook::jni::alias_ref<…>)) Registration-inl.h:95
[librnskia.so] facebook::jni::detail::MethodWrapper<void (RNSkia::JniPlatformContext::*)(), &RNSkia::JniPlatformContext::notifyDrawLoopExternal(), RNSkia::JniPlatformContext, void>::call(_JNIEnv*, _jobject*) Registration-inl.h:138
@StanislavDHH StanislavDHH added the bug Something isn't working label Aug 24, 2024
@StanislavDHH StanislavDHH changed the title Android Crash: Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT) Android Crash: Fatal signal 5 (SIGTRAP), code 1 (TRAP_BRKPT) - Thread Safety issue Aug 26, 2024
@wcandillon
Copy link
Contributor

Do you have an example we could use to reproduce the issue? Is it an issue that is easy to reproduce on your side?

@StanislavDHH
Copy link
Author

@wcandillon hi! Thanks for reply. Let me try to build an example app.

@wcandillon
Copy link
Contributor

v1.5.7 is published, I would love to get a read on whether it is improving Android stability?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants