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

Segfault in production Android app - facebook::hermes::debugger::EventObserver::breakpointResolved #1434

Closed
2 tasks done
MFazio23 opened this issue Jun 13, 2024 · 32 comments
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@MFazio23
Copy link

Bug Description

We have a massive (15K) amount of crashes in our production React Native Android app which are shown to end in the breakpointResolved function inside Hermes.

This crash occurs ~90% of the time on Motorola devices, though we've seen it a slight bit on other devices like Samsungs and Pixels.

It is also happening all over our app without a clear pattern as to something in particular causing it.

  • I have run gradle clean and confirmed this bug does not occur with JSC
  • The issue is reproducible with the latest version of React Native.

Hermes git revision (if applicable): N/A
React Native version: 0.72.1
OS: Android
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): arm64_v8a

Stack trace

OS Version: Android 12 (S3RDES32.123-37-5-11)
Report Version: 104

Exception Type: Unknown (SIGSEGV)

Application Specific Information:
Segfault

Thread 0 Crashed:
0   split_config.arm64_v8a.apk      0x73f0d32c70        facebook::hermes::debugger::EventObserver::breakpointResolved
1   split_config.arm64_v8a.apk      0x73f0ceebb4        facebook::hermes::debugger::EventObserver::breakpointResolved
2   split_config.arm64_v8a.apk      0x73f0da8a58        facebook::hermes::debugger::EventObserver::breakpointResolved
3   split_config.arm64_v8a.apk      0x73f0da80c8        facebook::hermes::debugger::EventObserver::breakpointResolved
4   split_config.arm64_v8a.apk      0x73f0da720c        facebook::hermes::debugger::EventObserver::breakpointResolved
5   split_config.arm64_v8a.apk      0x73f0daa250        facebook::hermes::debugger::EventObserver::breakpointResolved
6   split_config.arm64_v8a.apk      0x73f0da6fb0        facebook::hermes::debugger::EventObserver::breakpointResolved
7   split_config.arm64_v8a.apk      0x73f0da9804        facebook::hermes::debugger::EventObserver::breakpointResolved
8   split_config.arm64_v8a.apk      0x73f0d15574        facebook::hermes::debugger::EventObserver::breakpointResolved
9   split_config.arm64_v8a.apk      0x73f0d14650        facebook::hermes::debugger::EventObserver::breakpointResolved
10  split_config.arm64_v8a.apk      0x73f0d081c8        facebook::hermes::debugger::EventObserver::breakpointResolved
11  split_config.arm64_v8a.apk      0x73f0d03660        facebook::hermes::debugger::EventObserver::breakpointResolved
12  split_config.arm64_v8a.apk      0x73f0ce7db8        facebook::hermes::debugger::EventObserver::breakpointResolved
13  split_config.arm64_v8a.apk      0x73f0ce6cc0        facebook::hermes::debugger::EventObserver::breakpointResolved
14  split_config.arm64_v8a.apk      0x73f0d92fdc        facebook::hermes::debugger::EventObserver::breakpointResolved
15  split_config.arm64_v8a.apk      0x73f0ce7b54        facebook::hermes::debugger::EventObserver::breakpointResolved
16  split_config.arm64_v8a.apk      0x73f0d02664        facebook::hermes::debugger::EventObserver::breakpointResolved
17  split_config.arm64_v8a.apk      0x73f0d03ec4        facebook::hermes::debugger::EventObserver::breakpointResolved
18  split_config.arm64_v8a.apk      0x73f0d03660        facebook::hermes::debugger::EventObserver::breakpointResolved
19  split_config.arm64_v8a.apk      0x73f0ce7db8        facebook::hermes::debugger::EventObserver::breakpointResolved
20  split_config.arm64_v8a.apk      0x73f0ce6cc0        facebook::hermes::debugger::EventObserver::breakpointResolved
21  split_config.arm64_v8a.apk      0x73f0d92fdc        facebook::hermes::debugger::EventObserver::breakpointResolved
22  split_config.arm64_v8a.apk      0x73f0ce7b54        facebook::hermes::debugger::EventObserver::breakpointResolved
23  split_config.arm64_v8a.apk      0x73f0d02664        facebook::hermes::debugger::EventObserver::breakpointResolved
24  split_config.arm64_v8a.apk      0x73f0d03ec4        facebook::hermes::debugger::EventObserver::breakpointResolved
25  split_config.arm64_v8a.apk      0x73f0d03660        facebook::hermes::debugger::EventObserver::breakpointResolved
26  split_config.arm64_v8a.apk      0x73f0ce7db8        facebook::hermes::debugger::EventObserver::breakpointResolved
27  split_config.arm64_v8a.apk      0x73f0ce776c        facebook::hermes::debugger::EventObserver::breakpointResolved
28  split_config.arm64_v8a.apk      0x73f0cd86cc        facebook::jsi::Array::setValueAtIndex<T>
29  split_config.arm64_v8a.apk      0x73ed783aa8        facebook::jsi::Function::call<T>
30  split_config.arm64_v8a.apk      0x73ed783914        folly::to_ascii_with<T>
31  split_config.arm64_v8a.apk      0x73ed77ab44        std::__ndk1::__invoke_void_return_wrapper<T>::__call<T>
32  split_config.arm64_v8a.apk      0x73ed78043c        facebook::react::JSIExecutor::callFunction
33  split_config.arm64_v8a.apk      0x73f0aaaca0        facebook::react::JsToNativeBridge::callSerializableNativeHook
34  split_config.arm64_v8a.apk      0x73f0aabcb8        facebook::react::JsToNativeBridge::callSerializableNativeHook
35  split_config.arm64_v8a.apk      0x73f0a81144        facebook::react::JMessageQueueThread::~JMessageQueueThread
36  split_config.arm64_v8a.apk      0x7409296e84        facebook::jni::detail::MethodWrapper<T>::dispatch
37  split_config.arm64_v8a.apk      0x7409296dfc        facebook::jni::detail::FunctionWrapper<T>::call
38  base.odex                       0x741e0e0004        <unknown> + 498720440324

EOF

Steps To Reproduce

We have yet to reproduce this on our side and are going off of multiple crash/app health apps (Sentry/Crashlytics) to let us know this is happening. We've tested dev and production builds on lots of devices (including the most common Motorola device in the list) without seeing anything.

The Expected Behavior

The app does not crash.

@MFazio23 MFazio23 added the bug Something isn't working label Jun 13, 2024
@neildhar
Copy link
Contributor

Hey @MFazio23, looking at the stack, it looks like it hasn't been symbolicated properly, which is why the stack trace doesn't make sense, and so many frames are annotated with that one function.

Take a look at the steps here to get a proper stack trace: https://github.com/facebook/hermes/blob/main/doc/ReactNativeIntegration.md#react-native--071

@MFazio23
Copy link
Author

Thanks @neildhar - I did this before but I'll give it another shot because it looks like I got something wrong.

@MFazio23
Copy link
Author

We updated our app to use 0.73.6 (with plans for 0.74.x coming up), and the stack traces have changed (see below for an example), but the errors seem to be coming up just as frequently.

The stack trace was symbolicated by Sentry for us automatically, but when I uploaded the debug symbols to Crashlytics before, they were showing the same stack trace as Sentry.

With the doc linked above, I'm still confused by "you can just invoke ndk-stack and [it] will just work" - the ndk-stack command expects a symbol directory, so where does that come from?

OS Version: Android 12 (S3RDES32.123-37-5-11)
Report Version: 104

Exception Type: Unknown (SIGSEGV)

Application Specific Information:
Segfault

Thread 0 Crashed:
0   split_config.arm64_v8a.apk      0x6f8acc8bcc        facebook::hermes::HermesRuntime::~HermesRuntime
1   split_config.arm64_v8a.apk      0x6f8ac953e8        facebook::hermes::HermesRuntime::~HermesRuntime
2   split_config.arm64_v8a.apk      0x6f8ad3c430        facebook::hermes::HermesRuntime::~HermesRuntime
3   split_config.arm64_v8a.apk      0x6f8ad3ba8c        facebook::hermes::HermesRuntime::~HermesRuntime
4   split_config.arm64_v8a.apk      0x6f8ad3ae20        facebook::hermes::HermesRuntime::~HermesRuntime
5   split_config.arm64_v8a.apk      0x6f8ad3dcd0        facebook::hermes::HermesRuntime::~HermesRuntime
6   split_config.arm64_v8a.apk      0x6f8ad3abc8        facebook::hermes::HermesRuntime::~HermesRuntime
7   split_config.arm64_v8a.apk      0x6f8ad3d290        facebook::hermes::HermesRuntime::~HermesRuntime
8   split_config.arm64_v8a.apk      0x6f8ace8294        facebook::hermes::HermesRuntime::~HermesRuntime
9   split_config.arm64_v8a.apk      0x6f8ace5890        facebook::hermes::HermesRuntime::~HermesRuntime
10  split_config.arm64_v8a.apk      0x6f8acafcc0        facebook::hermes::HermesRuntime::~HermesRuntime
11  split_config.arm64_v8a.apk      0x6f8acece40        facebook::hermes::HermesRuntime::~HermesRuntime
12  split_config.arm64_v8a.apk      0x6f8ac8f93c        facebook::hermes::HermesRuntime::~HermesRuntime
13  split_config.arm64_v8a.apk      0x6f8aca0464        facebook::hermes::HermesRuntime::~HermesRuntime
14  split_config.arm64_v8a.apk      0x6f8aca1c9c        facebook::hermes::HermesRuntime::~HermesRuntime
15  split_config.arm64_v8a.apk      0x6f8aca14ac        facebook::hermes::HermesRuntime::~HermesRuntime
16  split_config.arm64_v8a.apk      0x6f8ac8fa4c        facebook::hermes::HermesRuntime::~HermesRuntime
17  split_config.arm64_v8a.apk      0x6f8ad0a854        facebook::hermes::HermesRuntime::~HermesRuntime
18  split_config.arm64_v8a.apk      0x6f8ac8f93c        facebook::hermes::HermesRuntime::~HermesRuntime
19  split_config.arm64_v8a.apk      0x6f8acaa92c        facebook::hermes::HermesRuntime::~HermesRuntime
20  split_config.arm64_v8a.apk      0x6f8aca1f4c        facebook::hermes::HermesRuntime::~HermesRuntime
21  split_config.arm64_v8a.apk      0x6f8aca14ac        facebook::hermes::HermesRuntime::~HermesRuntime
22  split_config.arm64_v8a.apk      0x6f8ac8fa4c        facebook::hermes::HermesRuntime::~HermesRuntime
23  split_config.arm64_v8a.apk      0x6f8ac8eb30        facebook::hermes::HermesRuntime::~HermesRuntime
24  split_config.arm64_v8a.apk      0x6f8ad26b40        facebook::hermes::HermesRuntime::~HermesRuntime
25  split_config.arm64_v8a.apk      0x6f8ac8f93c        facebook::hermes::HermesRuntime::~HermesRuntime
26  split_config.arm64_v8a.apk      0x6f8aca0464        facebook::hermes::HermesRuntime::~HermesRuntime
27  split_config.arm64_v8a.apk      0x6f8aca1c9c        facebook::hermes::HermesRuntime::~HermesRuntime
28  split_config.arm64_v8a.apk      0x6f8aca14ac        facebook::hermes::HermesRuntime::~HermesRuntime
29  split_config.arm64_v8a.apk      0x6f8ac8fa4c        facebook::hermes::HermesRuntime::~HermesRuntime
30  split_config.arm64_v8a.apk      0x6f8ad26dc0        facebook::hermes::HermesRuntime::~HermesRuntime
31  split_config.arm64_v8a.apk      0x6f8ac8f93c        facebook::hermes::HermesRuntime::~HermesRuntime
32  split_config.arm64_v8a.apk      0x6f8ad0a854        facebook::hermes::HermesRuntime::~HermesRuntime
33  split_config.arm64_v8a.apk      0x6f8ac8f93c        facebook::hermes::HermesRuntime::~HermesRuntime
34  split_config.arm64_v8a.apk      0x6f8acaa92c        facebook::hermes::HermesRuntime::~HermesRuntime
35  split_config.arm64_v8a.apk      0x6f8aca1f4c        facebook::hermes::HermesRuntime::~HermesRuntime
36  split_config.arm64_v8a.apk      0x6f8aca14ac        facebook::hermes::HermesRuntime::~HermesRuntime
37  split_config.arm64_v8a.apk      0x6f8ac8fa4c        facebook::hermes::HermesRuntime::~HermesRuntime
38  split_config.arm64_v8a.apk      0x6f8ac8eb30        facebook::hermes::HermesRuntime::~HermesRuntime
39  split_config.arm64_v8a.apk      0x6f8ad26b40        facebook::hermes::HermesRuntime::~HermesRuntime
40  split_config.arm64_v8a.apk      0x6f8ac8f93c        facebook::hermes::HermesRuntime::~HermesRuntime
41  split_config.arm64_v8a.apk      0x6f8aca0464        facebook::hermes::HermesRuntime::~HermesRuntime
42  split_config.arm64_v8a.apk      0x6f8aca1c9c        facebook::hermes::HermesRuntime::~HermesRuntime
43  split_config.arm64_v8a.apk      0x6f8aca14ac        facebook::hermes::HermesRuntime::~HermesRuntime
44  split_config.arm64_v8a.apk      0x6f8ac8fa4c        facebook::hermes::HermesRuntime::~HermesRuntime
45  split_config.arm64_v8a.apk      0x6f8ac8f5e4        facebook::hermes::HermesRuntime::~HermesRuntime
46  split_config.arm64_v8a.apk      0x6f8ac82630        facebook::jsi::Array::setValueAtIndex<T>
47  split_config.arm64_v8a.apk      0x6f8a86edc0        facebook::jsi::Function::call<T>
48  split_config.arm64_v8a.apk      0x6f8a86ec30        folly::to_ascii_with<T>
49  split_config.arm64_v8a.apk      0x6f8a866380        std::__ndk1::__function::__func<T>::operator()
50  split_config.arm64_v8a.apk      0x6f8a86b96c        facebook::react::JSIExecutor::callFunction
51  split_config.arm64_v8a.apk      0x6f8a966a3c        facebook::react::JsToNativeBridge::callSerializableNativeHook
52  split_config.arm64_v8a.apk      0x6f8a9679f4        facebook::react::JsToNativeBridge::callSerializableNativeHook
53  split_config.arm64_v8a.apk      0x6f8a93cc18        facebook::react::JMessageQueueThread::~JMessageQueueThread
54  split_config.arm64_v8a.apk      0x6f9309deb0        facebook::jni::detail::MethodWrapper<T>::dispatch
55  split_config.arm64_v8a.apk      0x6f9309de00        facebook::jni::detail::FunctionWrapper<T>::call
56  base.odex                       0x6fbc55c6c4        <unknown> + 479901107908

@neildhar
Copy link
Contributor

you can just invoke ndk-stack and [it] will just work

cc @cortinico who is the expert on the intended workflow here.

That said, you can also download the symbols directly from maven:
https://repo1.maven.org/maven2/com/facebook/react/hermes-android/

@cortinico
Copy link
Contributor

With the doc linked above, I'm still confused by "you can just invoke ndk-stack and [it] will just work" - the ndk-stack command expects a symbol directory, so where does that come from?

You'll have to point to your app build folder like:

adb logcat | $ANDROID_HOME/ndk/26.1.10909125/ndk-stack -sym android/app/build/intermediates/cmake/debug/obj/arm64-v8a

Also there was a sporadic bug with ndk-stack in NDK 26 (android/ndk#1993) which was resolved in NDK 27, which we sadly haven't bumped yet.

@MFazio23
Copy link
Author

MFazio23 commented Jul 9, 2024

We have a new stack trace and it looks like the symbolication worked better this time, but let me know if it's not.

********** Crash dump: **********
Build fingerprint: 'motorola/pnangn_g/pnangn:13/T1TPNS33.58-84-1/fdb480-dd2d08:user/release-keys'
#00 0x00000000000d3dcc /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
     void std::__ndk1::__cxx_atomic_store[abi:v170000]<bool>(std::__ndk1::__cxx_atomic_base_impl<bool>*, bool, std::__ndk1::memory_order)
     /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/atomic:950:5
     std::__ndk1::__atomic_base<bool, false>::store[abi:v170000](bool, std::__ndk1::memory_order)
     /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/atomic:1542:10
     hermes::vm::WeakMapEntrySlot::free()
     /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/WeakRefSlot.h:161:12
     hermes::vm::detail::WeakRefKey::releaseSlot()
     /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/JSWeakMapImpl.h:122:12
     hermes::vm::JSWeakMapImplBase::_finalizeImpl(hermes::vm::GCCell*, hermes::vm::HadesGC&)
     /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/JSWeakMapImpl.h:259:15
#01 0x0000000000145840 /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
     hermes::vm::VTable::finalizeIfExists(hermes::vm::GCCell*, hermes::vm::HadesGC&) const
     /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/VTable.h:175:7
     hermes::vm::HadesGC::OldGen::sweepNext(bool)
     /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1180:20
#02 0x0000000000147274 /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
     hermes::vm::HadesGC::incrementalCollect(bool)
     /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1689:20
#03 0x000000000014c3e0 /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
    hermes::vm::HadesGC::collectOGInBackground()::$_0::operator()() const
    /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1635:7
    decltype(std::declval<hermes::vm::HadesGC::collectOGInBackground()::$_0&>()()) std::__ndk1::__invoke[abi:v170000]<hermes::vm::HadesGC::collectOGInBackground()::$_0&>(hermes::vm::HadesGC::collectOGInBackground()::$_0&)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/invoke.h:394:23
    void std::__ndk1::__invoke_void_return_wrapper<void, true>::__call<hermes::vm::HadesGC::collectOGInBackground()::$_0&>(hermes::vm::HadesGC::collectOGInBackground()::$_0&)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/invoke.h:487:9
    std::__ndk1::__function::__alloc_func<hermes::vm::HadesGC::collectOGInBackground()::$_0, std::__ndk1::allocator<hermes::vm::HadesGC::collectOGInBackground()::$_0>, void ()>::operator()[abi:v170000]()
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/function.h:185:16
    std::__ndk1::__function::__func<hermes::vm::HadesGC::collectOGInBackground()::$_0, std::__ndk1::allocator<hermes::vm::HadesGC::collectOGInBackground()::$_0>, void ()>::operator()()
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/function.h:356:12
#04 0x000000000014b228 /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
    std::__ndk1::__function::__value_func<void ()>::operator()[abi:v170000]() const
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/function.h:510:16
    std::__ndk1::function<void ()>::operator()() const
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/function.h:1156:12
    hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()::operator()() const
    /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1050:7
    decltype(std::declval<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()&>()()) std::__ndk1::__invoke[abi:v170000]<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()&>(hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()&)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/invoke.h:394:23
    void std::__ndk1::__invoke_void_return_wrapper<void, true>::__call<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()&>(hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()&)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/invoke.h:487:9
#05 0x000000000014bca8 /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
    std::__ndk1::__function::__value_func<void ()>::operator()[abi:v170000]() const
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/function.h:510:16
    std::__ndk1::function<void ()>::operator()() const
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/function.h:1156:12
    hermes::vm::HadesGC::Executor::worker()
    /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1071:9
#06 0x000000000014bb60 /data/app/~~kM-kbquxHCxzW7L_nbmtwA==/com.meetalbert-iOjFX0CCUaeVeVDLclCDFQ==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
    hermes::vm::HadesGC::Executor::Executor()::'lambda'()::operator()() const
    /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1033:33
    decltype(std::declval<hermes::vm::HadesGC::Executor::Executor()::'lambda'()>()()) std::__ndk1::__invoke[abi:v170000]<hermes::vm::HadesGC::Executor::Executor()::'lambda'()>(hermes::vm::HadesGC::Executor::Executor()::'lambda'()&&)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__functional/invoke.h:394:23
    void std::__ndk1::__thread_execute[abi:v170000]<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct>>, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>(std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct>>, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>&, std::__ndk1::__tuple_indices<>)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/thread:282:5
    void* std::__ndk1::__thread_proxy[abi:v170000]<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct>>, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>>(void*)
    /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/thread:293:5
#07 0x00000000000f5108 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: bddac2439f5f0b431ea53a2f053677d9)
#08 0x000000000008eafc /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: bddac2439f5f0b431ea53a2f053677d9)

@jtdaugh
Copy link

jtdaugh commented Jul 9, 2024

I've finally been able to reproduce this fairly frequently (but without any exact/consistent repro steps) on my Motorola Moto 5G 2023.

Turning on Motorola's RAM Boost feature is critical to get our app to crash like this, and the crash stack traces reliably include Hades GC. We think the Hades GC is not interacting well with Motorola's implementation of virtual RAM in their "RAM boost" feature.

We have seem tens of thousands of these crashes in the wild in the last couple months. The "user perceived crash rate" we see in Google Play for most Motorola devices is over 10% which is just crazy. We'd love some help from the Hermes team on this.

Here's another symbolicated stack trace:

Crash dump
********** Crash dump: **********
Build fingerprint: 'motorola/pnangn_g/pnangn:13/T1TPNS33.58-84-1/fdb480-dd2d08:user/release-keys'
#00 0x00000000000d3dcc /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             void std::__ndk1::__cxx_atomic_store[abi:v170000]<bool>(std::__ndk1::__cxx_atomic_base_impl<bool>*, bool, std::__ndk1::memory_order)
                                                                                                                                             /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/atomic:950:5
                                                                                                                                             std::__ndk1::__atomic_base<bool, false>::store[abi:v170000](bool, std::__ndk1::memory_order)
                                                                                                                                             /opt/android/ndk/26.1.10909125/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/atomic:1542:10
                                                                                                                                             hermes::vm::WeakMapEntrySlot::free()
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/WeakRefSlot.h:161:12
                                                                                                                                             hermes::vm::detail::WeakRefKey::releaseSlot()
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/JSWeakMapImpl.h:122:12
                                                                                                                                             hermes::vm::JSWeakMapImplBase::_finalizeImpl(hermes::vm::GCCell*, hermes::vm::HadesGC&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/JSWeakMapImpl.h:259:15
#01 0x00000000001484ac /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::VTable::finalizeIfExists(hermes::vm::GCCell*, hermes::vm::HadesGC&) const
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/VTable.h:175:7
                                                                                                                                             hermes::vm::HadesGC::finalizeCompactee()
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:1755:24
#02 0x0000000000146ee8 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::HadesGC::youngGenCollection(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, bool)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:2523:7
#03 0x00000000001494b8 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::HadesGC::allocSlow(unsigned int)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/gcs/HadesGC.cpp:2203:3
#04 0x00000000000b8f9c /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             void* hermes::vm::HadesGC::allocWork<true, (hermes::vm::HasFinalizer)0>(unsigned int)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/HadesGC.h:1121:48
                                                                                                                                             hermes::vm::JSArray* hermes::vm::HadesGC::makeA<hermes::vm::JSArray, true, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(unsigned int, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/HadesGC.h:1099:7
                                                                                                                                             hermes::vm::JSArray* hermes::vm::GCBase::makeA<hermes::vm::JSArray, true, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(unsigned int, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/GCBase-inline.h:71:32
#05 0x00000000000b7e5c /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::JSArray* hermes::vm::GCBase::makeAFixed<hermes::vm::JSArray, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/GCBase-inline.h:31:10
                                                                                                                                             hermes::vm::JSArray* hermes::vm::Runtime::makeAFixed<hermes::vm::JSArray, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Runtime.h:1966:20
                                                                                                                                             hermes::vm::JSArray::createNoAllocPropStorage(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Handle<hermes::vm::HiddenClass>, unsigned int, unsigned int)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSArray.cpp:551:15
#06 0x00000000000becb4 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::JSObject::getOwnPropertyKeys(hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Runtime&, hermes::vm::OwnKeysFlags)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSObject.cpp:390:19
#07 0x00000000001275fc /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::getOwnPropertyKeysAsStrings(hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Runtime&, hermes::vm::OwnKeysFlags)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSLib/Object.cpp:464:13
#08 0x0000000000128048 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::enumerableOwnProperties_RJS(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::EnumerableOwnPropertiesKind)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSLib/Object.cpp:811:19
#09 0x000000000012699c /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::objectKeys(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSLib/Object.cpp:936:10
#10 0x000000000009bc50 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:507:9
#11 0x00000000000abf0c /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Interpreter::handleCallSlowPath(hermes::vm::Runtime&, hermes::vm::PinnedHermesValue*)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:274:12
#12 0x00000000000ad8c0 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:1620:7
#13 0x00000000000acf78 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:825:12
#14 0x000000000009bd60 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Callable.cpp:1123:20
#15 0x000000000009ae74 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:253:12
                                                                                                                                             hermes::vm::Callable::executeCall(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::JSObject>)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Callable.cpp:357:10
#16 0x0000000000132494 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::functionPrototypeApply(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSLib/Function.cpp:224:10
#17 0x000000000009bc50 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:507:9
#18 0x00000000000abf0c /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Interpreter::handleCallSlowPath(hermes::vm::Runtime&, hermes::vm::PinnedHermesValue*)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:274:12
#19 0x00000000000ad8c0 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:1620:7
#20 0x00000000000acf78 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:825:12
#21 0x000000000009bd60 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Callable.cpp:1123:20
#22 0x000000000009ae74 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:253:12
                                                                                                                                             hermes::vm::Callable::executeCall(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::JSObject>)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Callable.cpp:357:10
#23 0x0000000000132494 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::functionPrototypeApply(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/JSLib/Function.cpp:224:10
#24 0x000000000009bc50 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:507:9
#25 0x00000000000abf0c /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Interpreter::handleCallSlowPath(hermes::vm::Runtime&, hermes::vm::PinnedHermesValue*)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:274:12
#26 0x00000000000ad8c0 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:1620:7
#27 0x00000000000acf78 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Interpreter.cpp:825:12
#28 0x000000000009bd60 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Callable.cpp:1123:20
#29 0x000000000009b8dc /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:253:12
                                                                                                                                             hermes::vm::BoundFunction::_boundCall(hermes::vm::BoundFunction*, hermes::inst::Inst const*, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/lib/VM/Callable.cpp:779:9
#30 0x000000000008de54 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes.so (BuildId: 43d09a69d2534947de4730f86a46b2843530f8f9)
                                                                                                                                             hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/include/hermes/VM/Callable.h:253:12
                                                                                                                                             facebook::hermes::HermesRuntimeImpl::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)
                                                                                                                                             /root/react-native/packages/react-native/sdks/hermes/API/hermes/hermes.cpp:2186:18
#31 0x000000000002d310 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes_executor.so (facebook::jsi::Value facebook::jsi::Function::call<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::jsi::Value>(facebook::jsi::Runtime&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::jsi::Value&&) const+236) (BuildId: b58ea9fa364ca130)
#32 0x000000000002d170 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes_executor.so (BuildId: b58ea9fa364ca130)
#33 0x00000000000235f0 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes_executor.so (std::__ndk1::__function::__func<void (*)(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>), std::__ndk1::allocator<void (*)(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>)>, void (std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>)>::operator()(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>&&)+124) (BuildId: b58ea9fa364ca130)
#34 0x0000000000029fa4 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libhermes_executor.so (facebook::react::JSIExecutor::callFunction(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, folly::dynamic const&)+472) (BuildId: b58ea9fa364ca130)
#35 0x00000000000cb0a0 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libreactnativejni.so (BuildId: 18aa28824c388ff9)
#36 0x0000000000092e74 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!libreactnativejni.so (BuildId: 18aa28824c388ff9)
#37 0x0000000000019804 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!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*>)+72) (BuildId: a22242831a7971267de570e06121acb588ce64cd)
#38 0x0000000000019744 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/split_config.arm64_v8a.apk!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*>))+60) (BuildId: a22242831a7971267de570e06121acb588ce64cd)
#39 0x0000000000296cd4 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/oat/arm64/base.odex (art_jni_trampoline+116)
#40 0x0000000000a1d44c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+76)
#41 0x0000000002000b54 /memfd:jit-cache (deleted) (com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage+68)
#42 0x00000000020355a8 /memfd:jit-cache (deleted) (android.os.Looper.loopOnce+1512)
#43 0x0000000000a214c4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+1124)
#44 0x00000000005b7f98 /apex/com.android.art/lib64/libart.so (nterp_helper+152) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#45 0x0000000000221472 /data/app/~~RTFaExFoOd45MCB7O3kiYg==/com.meetalbert-vWWDGwwLKReunLSvc_fTDg==/base.apk (com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run+74)
#46 0x00000000003f97f8 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.Thread.run+72)
#47 0x000000000033a7a4 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#48 0x000000000023a01c /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+144) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#49 0x0000000000539054 /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1600) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#50 0x00000000000f5108 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: bddac2439f5f0b431ea53a2f053677d9)
#51 0x000000000008eafc /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: bddac2439f5f0b431ea53a2f053677d9)
Crash dump is completed

@neildhar
Copy link
Contributor

neildhar commented Jul 9, 2024

These stack traces make a lot more sense, thank you for sharing them. It is odd that this crash is so isolated to a particular type of device, but it is hard to say what might be happening without more information. Some things that would help:

  1. A minimal repro would be the gold standard here, since we can debug it and see what is going on.
  2. More (ideally different) stack traces, which might help us pinpoint the necessary conditions for this to happen. It would also be helpful to know if you're seeing this on other devices.
  3. Additional information from the full tombstone. Like the address that the crash is occurring on.
  4. An execution trace from the GC. For example, by adding an analytics callback through the RuntimeConfig and logging everything that the callback receives.

@jtdaugh
Copy link

jtdaugh commented Jul 10, 2024

We'll work on a repro repository and follow up in the meantime as we get new stack traces.

Is there any way to swap out the GC at runtime to switch from the default Hades to a different mode of Hades or to GenGC 0 if so we'd do so only on motorola devices... If not, is it possible to do the above but not at runtime - i.e. just change the Hermes GC statically for a given app release?

@neildhar
Copy link
Contributor

neildhar commented Jul 10, 2024

There isn't any way to swap the GC in production right now, since GenGC was deleted some time ago. Some other things you could try along similar lines:

  1. Force Hades into non-concurrent mode by setting HERMESVM_ALLOW_CONCURRENT_GC=ON when configuring the Hermes build.
  2. Use MallocGC, which is a simple GC that we use only for development and testing. You can enable this by setting HERMESVM_GCKIND=MALLOC. This isn't intended for production use.

Knowing whether you observe the crash in these scenarios will be useful in narrowing things down.

@jtdaugh
Copy link

jtdaugh commented Jul 11, 2024

We were able to build from source and force Hades into non-concurrent mode, and still get the crash. Here's a symbolicated stack trace with the non-concurrent Hades GC:

Crash dump:
********** Crash dump: **********
Build fingerprint: 'motorola/pnangn_g/pnangn:13/T1TPNS33.58-84-1/fdb480-dd2d08:user/release-keys'
#00 0x00000000000d2b74 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           void std::__ndk1::__cxx_atomic_store[abi:v170000]<bool>(std::__ndk1::__cxx_atomic_base_impl<bool>*, bool, std::__ndk1::memory_order)
                                                                                                                           /usr/local/share/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:950:5
                                                                                                                           std::__ndk1::__atomic_base<bool, false>::store[abi:v170000](bool, std::__ndk1::memory_order)
                                                                                                                           /usr/local/share/android-sdk/ndk/26.1.10909125/toolchains/llvm/prebuilt/darwin-x86_64/sysroot/usr/include/c++/v1/atomic:1542:10
                                                                                                                           hermes::vm::WeakMapEntrySlot::free()
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/WeakRefSlot.h:161:12
                                                                                                                           hermes::vm::detail::WeakRefKey::releaseSlot()
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/JSWeakMapImpl.h:122:12
                                                                                                                           hermes::vm::JSWeakMapImplBase::_finalizeImpl(hermes::vm::GCCell*, hermes::vm::HadesGC&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/JSWeakMapImpl.h:259:15
#01 0x00000000001440ac /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::VTable::finalizeIfExists(hermes::vm::GCCell*, hermes::vm::HadesGC&) const
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/VTable.h:175:7
                                                                                                                           hermes::vm::HadesGC::OldGen::sweepNext(bool)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/gcs/HadesGC.cpp:1180:20
#02 0x00000000001459c8 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::HadesGC::incrementalCollect(bool)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/gcs/HadesGC.cpp:1689:20
#03 0x00000000001481e0 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::HadesGC::yieldToOldGen()
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/gcs/HadesGC.cpp:3024:7
#04 0x00000000001456f0 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::HadesGC::youngGenCollection(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>>, bool)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/gcs/HadesGC.cpp:2577:3
#05 0x0000000000147768 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::HadesGC::allocSlow(unsigned int)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/gcs/HadesGC.cpp:2203:3
#06 0x00000000000b7d4c /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           void* hermes::vm::HadesGC::allocWork<true, (hermes::vm::HasFinalizer)0>(unsigned int)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/HadesGC.h:1121:48
                                                                                                                           hermes::vm::JSArray* hermes::vm::HadesGC::makeA<hermes::vm::JSArray, true, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(unsigned int, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/HadesGC.h:1099:7
                                                                                                                           hermes::vm::JSArray* hermes::vm::GCBase::makeA<hermes::vm::JSArray, true, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(unsigned int, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/GCBase-inline.h:71:32
#07 0x00000000000b6c0c /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::JSArray* hermes::vm::GCBase::makeAFixed<hermes::vm::JSArray, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/GCBase-inline.h:31:10
                                                                                                                           hermes::vm::JSArray* hermes::vm::Runtime::makeAFixed<hermes::vm::JSArray, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers>(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>&, hermes::vm::Handle<hermes::vm::HiddenClass>&, hermes::vm::GCPointerBase::NoBarriers&&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Runtime.h:1966:20
                                                                                                                           hermes::vm::JSArray::createNoAllocPropStorage(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::JSObject>, hermes::vm::Handle<hermes::vm::HiddenClass>, unsigned int, unsigned int)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/JSArray.cpp:551:15
#08 0x00000000000af784 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:2943:11
#09 0x00000000000abd28 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:825:12
#10 0x000000000009af88 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Callable.cpp:1123:20
#11 0x000000000009a0a4 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Callable.h:253:12
                                                                                                                           hermes::vm::Callable::executeCall(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::JSObject>)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Callable.cpp:357:10
#12 0x0000000000130cec /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::functionPrototypeApply(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/JSLib/Function.cpp:224:10
#13 0x000000000009ae78 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Callable.h:507:9
#14 0x00000000000aacbc /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Interpreter::handleCallSlowPath(hermes::vm::Runtime&, hermes::vm::PinnedHermesValue*)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:274:12
#15 0x00000000000ac670 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:1620:7
#16 0x00000000000abd28 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:825:12
#17 0x000000000009af88 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Callable.cpp:1123:20
#18 0x000000000009a0a4 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Callable.h:253:12
                                                                                                                           hermes::vm::Callable::executeCall(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::JSObject>)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Callable.cpp:357:10
#19 0x0000000000130cec /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::functionPrototypeApply(void*, hermes::vm::Runtime&, hermes::vm::NativeArgs)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/JSLib/Function.cpp:224:10
#20 0x000000000009ae78 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::NativeFunction::_nativeCall(hermes::vm::NativeFunction*, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Callable.h:507:9
#21 0x00000000000aacbc /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Interpreter::handleCallSlowPath(hermes::vm::Runtime&, hermes::vm::PinnedHermesValue*)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:274:12
#22 0x00000000000ac670 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:1620:7
#23 0x00000000000abd28 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Interpreter.cpp:825:12
#24 0x000000000009af88 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Callable.cpp:1123:20
#25 0x000000000009ab04 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Callable.h:253:12
                                                                                                                           hermes::vm::BoundFunction::_boundCall(hermes::vm::BoundFunction*, hermes::inst::Inst const*, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/lib/VM/Callable.cpp:779:9
#26 0x000000000008d084 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes.so (BuildId: 52e558ba658d59f904606999c233f7d414a14268)
                                                                                                                           hermes::vm::Callable::call(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/include/hermes/VM/Callable.h:253:12
                                                                                                                           facebook::hermes::HermesRuntimeImpl::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long)
                                                                                                                           /Users/vagrant/git/hermes-74.2-ConcurrentGC-Disabled/API/hermes/hermes.cpp:2186:18
#27 0x000000000002d310 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes_executor.so (facebook::jsi::Value facebook::jsi::Function::call<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::jsi::Value>(facebook::jsi::Runtime&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, facebook::jsi::Value&&) const+236) (BuildId: b58ea9fa364ca130)
                                                                                                                                    facebook::jsi::Value facebook::jsi::Function::call<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, facebook::jsi::Value>(facebook::jsi::Runtime&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, facebook::jsi::Value&&) const
                                                                                                                                    ??:0:0
#28 0x000000000002d170 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes_executor.so (BuildId: b58ea9fa364ca130)
                                                                                                                                    ??
                                                                                                                                    ??:0:0
#29 0x00000000000235f0 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes_executor.so (std::__ndk1::__function::__func<void (*)(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>), std::__ndk1::allocator<void (*)(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>)>, void (std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>)>::operator()(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > ()>&&)+124) (BuildId: b58ea9fa364ca130)
                                                                                                                                    std::__ndk1::__function::__func<void (*)(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> ()>), std::__ndk1::allocator<void (*)(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> ()>)>, void (std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> ()>)>::operator()(std::__ndk1::function<void ()> const&, std::__ndk1::function<std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> ()>&&)
                                                                                                                                    ??:0:0
#30 0x0000000000029fa4 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libhermes_executor.so (facebook::react::JSIExecutor::callFunction(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char> > const&, folly::dynamic const&)+472) (BuildId: b58ea9fa364ca130)
                                                                                                                                    facebook::react::JSIExecutor::callFunction(std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, std::__ndk1::basic_string<char, std::__ndk1::char_traits<char>, std::__ndk1::allocator<char>> const&, folly::dynamic const&)
                                                                                                                                    ??:0:0
#31 0x00000000000cb0a0 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libreactnativejni.so (BuildId: 18aa28824c388ff9)
                                                                                                                                   ??
                                                                                                                                   ??:0:0
#32 0x0000000000092e74 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!libreactnativejni.so (BuildId: 18aa28824c388ff9)
                                                                                                                                   ??
                                                                                                                                   ??:0:0
#33 0x0000000000019804 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!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*>)+72) (BuildId: a22242831a7971267de570e06121acb588ce64cd)
                                                                                                                          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*>)
                                                                                                                          ??:0:0
#34 0x0000000000019744 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/base.apk!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*>))+60) (BuildId: a22242831a7971267de570e06121acb588ce64cd)
                                                                                                                          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*>))
                                                                                                                          ??:0:0
#35 0x0000000000351230 /apex/com.android.art/lib64/libart.so (art_quick_generic_jni_trampoline+144) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#36 0x0000000000a1d44c /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Handler.dispatchMessage+76)
#37 0x000000000205b534 /memfd:jit-cache (deleted) (com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage+68)
#38 0x000000000201e8e8 /memfd:jit-cache (deleted) (android.os.Looper.loopOnce+1512)
#39 0x0000000000a214c4 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (android.os.Looper.loop+1124)
#40 0x00000000005b7f98 /apex/com.android.art/lib64/libart.so (nterp_helper+152) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#41 0x00000000015c4a32 /data/app/~~b2qa_Ln2HOmaiBoiPV6IDA==/com.meetalbert-4KwoRmmMw45rlkTDRCAWng==/oat/arm64/base.vdex (com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run+74)
#42 0x00000000003f97f8 /data/misc/apexdata/com.android.art/dalvik-cache/arm64/boot.oat (java.lang.Thread.run+72)
#43 0x000000000033a7a4 /apex/com.android.art/lib64/libart.so (art_quick_invoke_stub+612) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#44 0x000000000023a01c /apex/com.android.art/lib64/libart.so (art::ArtMethod::Invoke(art::Thread*, unsigned int*, unsigned int, art::JValue*, char const*)+144) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#45 0x0000000000539054 /apex/com.android.art/lib64/libart.so (art::Thread::CreateCallback(void*)+1600) (BuildId: 5b1e3dce5abfbdc410d71d256d308227)
#46 0x00000000000f5108 /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: bddac2439f5f0b431ea53a2f053677d9)
#47 0x000000000008eafc /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: bddac2439f5f0b431ea53a2f053677d9)

@neildhar
Copy link
Contributor

neildhar commented Jul 11, 2024

@jtdaugh Could you also share the crash address?

If you're building from source, could you try building with address sanitizer? An ASan report here would make it possible to understand why that write is failing.

@jtdaugh
Copy link

jtdaugh commented Jul 12, 2024

Here is the full tombstone:
tombstone_11.txt

Can you share how we can build with address sanitizer? We're open to trying/modifying any and all build flags to see if we can find & fix the root cause, so if you have any ideas beyond HERMESVM_ALLOW_CONCURRENT_GC please let me know too.

@neildhar
Copy link
Contributor

neildhar commented Jul 12, 2024

@jtdaugh Could you share more tombstones? It would be interesting to see if there is a pattern in the crash addresses.

To build Hermes with address sanitizer, you can set HERMES_ENABLE_ADDRESS_SANITIZER=ON. I'm not sure about the rest of the application though.

It would also be useful to build Hermes with asserts enabled (if you aren't already), which would hopefully catch this sooner. This should just be a matter of setting CMAKE_BUILD_TYPE=Debug when configuring Hermes.

@jtdaugh
Copy link

jtdaugh commented Jul 12, 2024

10 other tombstones attached. These all came from a different build (an actual play store distribution IIRC) without the custom hermes build - instead w/ the prepackaged hermes.

Will follow up after getting some crashes w/ ASan and asserts enabled

tombstone_00.txt
tombstone_01.txt
tombstone_02.txt
tombstone_03.txt
tombstone_04.txt
tombstone_05.txt
tombstone_06.txt
tombstone_07.txt
tombstone_08.txt
tombstone_09.txt
tombstone_10.txt

@jtdaugh
Copy link

jtdaugh commented Jul 18, 2024

@neildhar I've been struggling to get the app to build with ASan and CMAKE_BUILD_TYPE=Debug. In my setup I'm pointing RN to the custom hermes source and letting hermes be built from that custom source, I'm not separately directly cmaking the hermes binary.

Is simply exportingCMAKE_BUILD_TYPE=Debug and HERMES_ENABLE_ADDRESS_SANITIZER=ON env vars while running REACT_NATIVE_OVERRIDE_HERMES_DIR=<local_hermes_path> yarn android sufficient or do I need to set these build vars elsewhere (in local_hermes_path/android/hermes/build.grade?) for them to be picked up.

@jtdaugh
Copy link

jtdaugh commented Jul 18, 2024

@neildhar here is a crash and tombstone that I believe have a debug build type and ASan enabled:

tombstone_18.txt
moto-crash-18.txt

@jtdaugh
Copy link

jtdaugh commented Jul 18, 2024

Noticed the above (18) was not a hades crash.. Here is a newer crash that is back in Hades:
tombstone_19.txt
crash-19-moto-symbolicated.txt

@neildhar
Copy link
Contributor

do I need to set these build vars elsewhere

I would expect you would set them in the same place you set HERMESVM_ALLOW_CONCURRENT_GC .

Here is a newer crash that is back in Hades

I was hoping that this would provide some more information about rogue access, but it doesn't look like there is an ASan report here.

What fraction of your crashes on these Motorola devices have a Hermes stack trace? Is it possible that this is just general heap corruption happening somewhere else in your app?

@jtdaugh
Copy link

jtdaugh commented Aug 2, 2024

@neildhar we've been able to create release builds with all debug symbols included and repro the crash on my motorola device, and have some more detailed stack traces w/ tombstones attached here. One of these is an outlier, the other 3 are the exact same stack trace:

#00 pc 00000000000cb3bc  libhermes.so (hermes::vm::JSWeakMapImplBase::_finalizeImpl(hermes::vm::GCCell*, hermes::vm::HadesGC&)+92)
#01 pc 0000000000149744  libhermes.so (hermes::vm::HadesGC::OldGen::sweepNext(bool)+652)
#02 pc 0000000000152160  libhermes.so (std::__ndk1::__function::__func<hermes::vm::HadesGC::collectOGInBackground()::$_0, std::__ndk1::allocator<hermes::vm::HadesGC::collectOGInBackground()::$_0>, void ()>::operator()()+164)
#03 pc 0000000000150910  libhermes.so (std::__ndk1::__function::__func<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'(), std::__ndk1::allocator<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()>, void ()>::operator()()+32)
#04 pc 0000000000151808  libhermes.so (hermes::vm::HadesGC::Executor::worker()+468)
#05 pc 00000000001515fc  libhermes.so (void* std::__ndk1::__thread_proxy[abi:v170000]<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >(void*)+40) 
#06 pc 00000000000f5108  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208)
#07 pc 000000000008eafc  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68)

crash30.txt
crash29.txt
crash28.txt
crash27.txt
tombstone_30.txt
tombstone_27.txt
tombstone_28.txt
tombstone_29.txt

@jtdaugh
Copy link

jtdaugh commented Aug 2, 2024

@neildhar we made this change the the hermes source as a hail mary, and have not observed a crash yet on this build, on my device that was reliably crashing every minute or so on vanilla hermes. I'll keep playing with this build for a while longer, but am curious about your thoughts on this potential fix.

Screenshot 2024-08-02 at 11 30 14 AM

@neildhar
Copy link
Contributor

neildhar commented Aug 2, 2024

@jtdaugh Wow, this is extremely strange. Can you confirm that you are still building without HERMESVM_ALLOW_CONCURRENT_GC? If this is happening without the concurrent GC, there can't really be an ordering issue on that flag within the GC. It may however suggest that there are multiple threads trying to use the same runtime in your application.

@neildhar
Copy link
Contributor

neildhar commented Aug 2, 2024

@jtdaugh One potential theory is that the memory trimming code is being invoked for some reason in these circumstances, and ends up calling into the GC unsafely from another thread. Do you see anything in the logcat output related to memory warnings?

Two other interesting things to note:

  1. There appear to be two Hermes runtimes in this app (which as fine as long as each is only used from a single thread at a time)
  2. One of the crashes is actually in the Java GC

@lukmccall
Copy link

This app utilizes react-native-reanimated, which creates an additional runtime invoked on the UI thread. This should not be a problem.

@tmikov
Copy link
Contributor

tmikov commented Aug 5, 2024

Since this appears to be thread related, and happens even with single-threaded GC, I think we should at least carefully consider the possibility that the problem is related to react-native-reanimated, directly or indirectly.

Let's look at what we know: there is a crash that happens very often and reproducibly and it appears to be thread-related. It only happens in this app. Hermes is deployed to hundreds of millions of devices, if this was happening commonly, we would now for sure.

So, there is something that sets this particular app apart. We need to identify what this is.

This doesn't mean that there is a bug in react-native-reanimated or in the app. It could be some strange interaction. It could be a bug in Hermes that is only triggered in this case.

So, what is different?

@lukmccall
Copy link

You’re right that we should consider reanimated as a potential factor. I'm just saying that it’s not unusual for an app to have two runtimes – one for react-native and another for reanimated, and this setup is completely normal.

@neildhar
Copy link
Contributor

neildhar commented Aug 6, 2024

@lukmccall There was another issue recently where someone mentioned that reanimated uses WeakMap. Is it possible for these WeakMap accesses to take place in the same runtime on multiple threads? Or perhaps that there are cross-runtime references being held in the WeakMap? Given the crash is in WeakMap garbage collection, that could be strong evidence there is some bad interaction with reanimated here.

@lukmccall
Copy link

That might be the case. I have a theory on why this happens, but I'm still investigating it. I will come back with my findings.

@jtdaugh
Copy link

jtdaugh commented Aug 8, 2024

Thanks everyone for the help on this.

I want to re-flag that this crash is nearly exclusively happening at extreme rates on Motorola devices (with one TCL phone as an exception that you'll see in this first screenshot), despite Motorola devices being < 10% of our android install base.
bad_behavior_devices

Most of the above bad-behavior devices do have 3-4gb which is on the low end, but there are several other devices in this range of < 4GB RAM that are at our normal crash rates well below 1% (see next screenshot), which leads me to think it's not purely a crash caused by high memory usage, a general leak, or a logical error in our code or for example in our worklets, since you'd expect such an error to be exposed roughly evenly on all devices.
other_devices_lessthan_4gb_ram

Also worth noting that our app has absolutely no functionality that is exclusive to these motorola devices.

So it must be some characteristic of their hardware, chipset, virtual RAM implementation or something else that is interacting poorly with some part of our app or our dependencies.

@MFazio23
Copy link
Author

MFazio23 commented Aug 28, 2024

We finally determined the conflict in our application; the NewRelic library appears to be the source of these crashes. I've opened an issue with the NR team on the problem but the crashes have gone away in our latest release after disabling NewRelic.

We did get some more detailed stack traces in case this is any help as to why NR is conflicting with something in the app:

15:15:07.763  A  Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x1045535201 in tid 18512 (hades), pid 18027
15:15:08.335  A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
15:15:08.335  A  Build fingerprint: 'motorola/genevn_g/genevn:14/U1TGNS34.42-86-2-3/4bc63-fbbf6:user/release-keys'
15:15:08.335  A  Revision: 'pvt1'
15:15:08.335  A  ABI: 'arm64'
15:15:08.335  A  Timestamp: 2024-08-16 15:15:07.848788387-0500
15:15:08.335  A  Process uptime: 228s
15:15:08.335  A  pid: 18027, tid: 18512, name: hades
15:15:08.335  A  uid: 10442
15:15:08.335  A  tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
15:15:08.335  A  signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0000001045535201
15:15:08.335  A      x0  0000006f2bcd7878  x1  0000006f29400380  x2  000000713e605df8  x3  0000006e4ec1ec00
15:15:08.335  A      x4  0000000000000000  x5  0000000000000000  x6  0000000000000000  x7  0000000000000000
15:15:08.335  A      x8  0000000000000001  x9  b400006e4ec1e810  x10 b400006e4ec1ec00  x11 0000001045535201
15:15:08.335  A      x12 0000001045535201  x13 00000071e08fa740  x14 0000000004000000  x15 0000000000000028
15:15:08.335  A      x16 0000000000000001  x17 00000071e09d2410  x18 0000006fff2c6000  x19 0000006f294006e8
15:15:08.335  A      x20 0000000000000001  x21 0000000000000011  x22 0000006f2bcd7478  x23 0000006f2bcd7878
15:15:08.335  A      x24 0000000000000040  x25 0000006f2bcd78b8  x26 00000000000c0e98  x27 0000006f2c000000
15:15:08.335  A      x28 b400007080382a00  x29 0000007089b05ab0
15:15:08.335  A      lr  0000006ff425aae0  sp  0000007089b05a70  pc  0000006ff41dc538  pst 0000000080001000
15:15:08.335  A  8 total frames
15:15:08.335  A  backtrace:
15:15:08.335  A        #00 pc 00000000000cb538  /data/app/~~vpNu8lmPsQ1Ei1QE8q2BzA==/rYUD4wlZJRGk2FpYdrJeYw==/lib/arm64/libhermes.so (hermes::vm::JSWeakMapImplBase::_finalizeImpl(hermes::vm::GCCell*, hermes::vm::HadesGC&)+92) (BuildId: 5c153b5d643881f64f633641c98ad0682bf62752)
15:15:08.335  A        #01 pc 0000000000149adc  /data/app/~~vpNu8lmPsQ1Ei1QE8q2BzA==/rYUD4wlZJRGk2FpYdrJeYw==/lib/arm64/libhermes.so (hermes::vm::HadesGC::OldGen::sweepNext(bool)+652) (BuildId: 5c153b5d643881f64f633641c98ad0682bf62752)
15:15:08.335  A        #02 pc 0000000000152540  /data/app/~~vpNu8lmPsQ1Ei1QE8q2BzA==/rYUD4wlZJRGk2FpYdrJeYw==/lib/arm64/libhermes.so (std::__ndk1::__function::__func<hermes::vm::HadesGC::collectOGInBackground()::$_0, std::__ndk1::allocator<hermes::vm::HadesGC::collectOGInBackground()::$_0>, void ()>::operator()()+164) (BuildId: 5c153b5d643881f64f633641c98ad0682bf62752)
15:15:08.335  A        #03 pc 0000000000150cd8  /data/app/~~vpNu8lmPsQ1Ei1QE8q2BzA==/rYUD4wlZJRGk2FpYdrJeYw==/lib/arm64/libhermes.so (std::__ndk1::__function::__func<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'(), std::__ndk1::allocator<hermes::vm::HadesGC::Executor::add(std::__ndk1::function<void ()>)::'lambda'()>, void ()>::operator()()+32) (BuildId: 5c153b5d643881f64f633641c98ad0682bf62752)
15:15:08.335  A        #04 pc 0000000000151be0  /data/app/~~vpNu8lmPsQ1Ei1QE8q2BzA==/rYUD4wlZJRGk2FpYdrJeYw==/lib/arm64/libhermes.so (hermes::vm::HadesGC::Executor::worker()+468) (BuildId: 5c153b5d643881f64f633641c98ad0682bf62752)
15:15:08.335  A        #05 pc 00000000001519d4  /data/app/~~vpNu8lmPsQ1Ei1QE8q2BzA==/rYUD4wlZJRGk2FpYdrJeYw==/lib/arm64/libhermes.so (void* std::__ndk1::__thread_proxy[abi:v170000]<std::__ndk1::tuple<std::__ndk1::unique_ptr<std::__ndk1::__thread_struct, std::__ndk1::default_delete<std::__ndk1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >(void*)+40) (BuildId: 5c153b5d643881f64f633641c98ad0682bf62752)
15:15:08.335  A        #06 pc 00000000000fcf74  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 284d65da9c7eadcb4f58fe07ba016b9f)
15:15:08.335  A        #07 pc 0000000000096924  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+68) (BuildId: 284d65da9c7eadcb4f58fe07ba016b9f)

@MFazio23
Copy link
Author

Quick update: we were able to keep most of our NewRelic monitoring enabled and avoid crashes by turning off the nativeCrashReportingEnabled flag in our NewRelic config (per the suggestion of the NR team). This issue is now resolved on our end.

@neildhar
Copy link
Contributor

Thanks for the update @MFazio23, closing this issue since there's no action needed in Hermes.

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

6 participants