I’m using React Native with Expo and TanStack React Query to fetch data in my app. Everything works fine in development, but in the production build on iOS, the app crashes whenever I log in (which triggers a data fetch using React Query).
I suspect the issue is with TanStack React Query based on the logs, but I’m not entirely sure. Below are the logs and the error I’m encountering:
XHR info GET: https://api/api/v1/chat/conversations?search= [200]
EXC_BAD_ACCESS: functionPrototype > natural > objectPrototype >
KERN_INVALID_ADDRESS at 0x28
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0074656c6b726f57 -> 0x0000656c6b726f57 (possible pointer authentication failure)
Exception Codes: 0x0000000000000001, 0x0074656c6b726f57
VM Region Info: 0x656c6b726f57 is not in any region. Bytes after previous region: 5962680397656
REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL
MALLOC_NANO 600000000000-600020000000 [512.0M] rw-/rwx SM=PRV
--->
UNUSED SPACE AT END
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [59019]
Triggered by Thread: 0
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 hermes 0x1086d0f8c hermes::vm::HadesGC::EvacAcceptor<false>::acceptNullable(hermes::vm::PinnedHermesValue&) + 12
1 hermes 0x10862cf10 hermes::vm::GCScope::mark(hermes::vm::RootAcceptor&) + 100
2 hermes 0x10862ce98 hermes::vm::HandleRootOwner::markGCScopes(hermes::vm::RootAcceptor&) + 36
3 hermes 0x108661e70 hermes::vm::Runtime::markRoots(hermes::vm::RootAndSlotAcceptorWithNames&, bool) + 4208
4 hermes 0x1086ccdf0 void hermes::vm::HadesGC::youngGenEvacuateImpl<hermes::vm::HadesGC::EvacAcceptor<false>>(hermes::vm::HadesGC::EvacAcceptor<false>&, bool) + 76
5 hermes 0x1086ca128 hermes::vm::HadesGC::youngGenCollection(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, bool) + 556
6 hermes 0x1086cc5d8 hermes::vm::HadesGC::allocSlow(unsigned int) + 56
7 hermes 0x108677738 hermes::vm::BufferedStringPrimitive<char>* hermes::vm::GCBase::makeA<hermes::vm::BufferedStringPrimitive<char>, false, (hermes::vm::HasFinalizer)0, (hermes::vm::LongLived)0, hermes::vm::Runtime&, unsigned int&, hermes::vm::Handle<hermes::vm::ExternalStringPrimitive<char>>&>(unsigned int, hermes::vm::Runtime&, unsigned int&, hermes::vm::Handle<hermes::vm::ExternalStringPrimitive<char>>&) + 104
8 hermes 0x108674754 hermes::vm::BufferedStringPrimitive<char>::create(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::StringPrimitive>, hermes::vm::Handle<hermes::vm::StringPrimitive>) + 188
9 hermes 0x1086758dc hermes::vm::StringPrimitive::concat(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::StringPrimitive>, hermes::vm::Handle<hermes::vm::StringPrimitive>) + 236
10 hermes 0x10865b53c hermes::vm::addOp_RJS(hermes::vm::Runtime&, hermes::vm::Handle<hermes::vm::HermesValue>, hermes::vm::Handle<hermes::vm::HermesValue>) + 276
11 hermes 0x108636208 hermes::vm::CallResult<hermes::vm::HermesValue, (hermes::vm::detail::CallResultSpecialize)2> hermes::vm::Interpreter::interpretFunction<false, false>(hermes::vm::Runtime&, hermes::vm::InterpreterState&) + 13388
12 hermes 0x108632d94 hermes::vm::Runtime::interpretFunctionImpl(hermes::vm::CodeBlock*) + 52
13 hermes 0x108625e2c hermes::vm::JSFunction::_callImpl(hermes::vm::Handle<hermes::vm::Callable>, hermes::vm::Runtime&) + 40
14 hermes 0x10860f790 facebook::hermes::HermesRuntimeImpl::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 284
15 OraCash 0x10438b6c4 facebook::jsi::RuntimeDecorator<facebook::jsi::Runtime, facebook::jsi::Runtime>::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 36 (decorator.h:347) [inlined]
16 OraCash 0x10438b6c4 facebook::jsi::WithRuntimeDecorator<reanimated::AroundLock, facebook::jsi::Runtime, facebook::jsi::Runtime>::call(facebook::jsi::Function const&, facebook::jsi::Value const&, facebook::jsi::Value const*, unsigned long) + 96 (decorator.h:764)
17 OraCash 0x104380ba0 facebook::jsi::Function::call(facebook::jsi::Runtime&, facebook::jsi::Value const*, unsigned long) const + 44 (jsi-inl.h:264) [inlined]
18 OraCash 0x104380ba0 facebook::jsi::Function::call(facebook::jsi::Runtime&, std::initializer_list<facebook::jsi::Value>) const + 44 (jsi-inl.h:269) [inlined]
19 OraCash 0x104380ba0 facebook::jsi::Value facebook::jsi::Function::call<facebook::jsi::Value&, facebook::jsi::String>(facebook::jsi::Runtime&, facebook::jsi::Value&, facebook::jsi::String&&) const + 148 (jsi-inl.h:277)
20 OraCash 0x104380a70 reanimated::ShareableWorklet::toJSValue(facebook::jsi::Runtime&) + 100 (Shareables.cpp:263)
21 OraCash 0x1043805f0 reanimated::ShareableObject::toJSValue(facebook::jsi::Runtime&) + 184 (Shareables.cpp:236)
22 OraCash 0x1043805f0 reanimated::ShareableObject::toJSValue(facebook::jsi::Runtime&) + 184 (Shareables.cpp:236)
23 OraCash 0x104380a2c reanimated::ShareableWorklet::toJSValue(facebook::jsi::Runtime&) + 32 (Shareables.cpp:262)
24 OraCash 0x1043805f0 reanimated::ShareableObject::toJSValue(facebook::jsi::Runtime&) + 184 (Shareables.cpp:236)
25 OraCash 0x1043805f0 reanimated::ShareableObject::toJSValue(facebook::jsi::Runtime&) + 184 (Shareables.cpp:236)
26 OraCash 0x104380a2c reanimated::ShareableWorklet::toJSValue(facebook::jsi::Runtime&) + 32 (Shareables.cpp:262)
27 OraCash 0x10437fa28 reanimated::ShareableArray::toJSValue(facebook::jsi::Runtime&) + 132 (Shareables.cpp:187)
28 OraCash 0x10437fa28 reanimated::ShareableArray::toJSValue(facebook::jsi::Runtime&) + 132 (Shareables.cpp:187)
29 OraCash 0x1043805f0 reanimated::ShareableObject::toJSValue(facebook::jsi::Runtime&) + 184 (Shareables.cpp:236)
30 OraCash 0x1043805f0 reanimated::ShareableObject::toJSValue(facebook::jsi::Runtime&) + 184 (Shareables.cpp:236)
31 OraCash 0x104380a2c reanimated::ShareableWorklet::toJSValue(facebook::jsi::Runtime&) + 32 (Shareables.cpp:262)
32 OraCash 0x10436283c facebook::jsi::Value reanimated::WorkletRuntime::runGuarded<>(std::__1::shared_ptr<reanimated::ShareableWorklet> const&) const + 24 (WorkletRuntime.h:42) [inlined]
33 OraCash 0x10436283c reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9::operator()() const + 28 (NativeReanimatedModule.cpp:207) [inlined]
34 OraCash 0x10436283c decltype(std::declval<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9&>()()) std::__1::__invoke[abi:ue170006]<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9&>(reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9&) + 28 (invoke.h:340) [inlined]
35 OraCash 0x10436283c void std::__1::__invoke_void_return_wrapper<void, true>::__call[abi:ue170006]<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9&>(reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9&) + 28 (invoke.h:415) [inlined]
36 OraCash 0x10436283c std::__1::__function::__alloc_func<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9, std::__1::allocator<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9>, void ()>::operator()[abi:ue170006]() + 28 (function.h:193) [inlined]
37 OraCash 0x10436283c std::__1::__function::__func<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9, std::__1::allocator<reanimated::NativeReanimatedModule::scheduleOnUI(facebook::jsi::Runtime&, facebook::jsi::Value const&)::$_9>, void ()>::operator()() + 48 (function.h:364)
38 OraCash 0x104388924 std::__1::__function::__value_func<void ()>::operator()[abi:ue170006]() const + 20 (function.h:518) [inlined]
39 OraCash 0x104388924 std::__1::function<void ()>::operator()() const + 20 (function.h:1169) [inlined]
React Native: 0.74.5
TanStack React Query: 5.55.4
Hermes: Enabled
The crash occurs only in the iOS production build.
The crash seems to happen while fetching data with React Query right after login.
Has anyone faced similar issues with React Query and Hermes in the iOS production build?
Are there any known compatibility issues or workarounds for this problem?
1