react-native-reanimated: iOS app crashes on restart

Description

We’re using "react-native-restart": "^0.0.24" in our iOS application, since it is required to reload an application to enable RTL. Occasionally there are some random crashes happening on app restarts. This happens both on a real device and on a simulator as well, during development.

This started to occur after we enabled hermes and updated reanimated to v2.

No animations or anything is running during or before Restart is called.

The following happens before app is restarted, if that is of any importance:

  • Language change event is reported to analytics module
  • I18nManager.allowRTL and I18nManager.forceRTL are called
  • Redux locale prop is updated
  • RNRestart.Restart() is called after 1sec delay

After that the app either reloads js bundle successfully or crashes.

Native crash stacktrace mentions reanimated.

#3. Crashed: com.facebook.react.JavaScript
EXC_BAD_ACCESS 0x0000000000000001
0   Crypto News              ~Pointer + 12 [inlined] (jsi.h:371)
1   Crypto News              ~Object + 12 [inlined] (jsi.h:562)
2   Crypto News              ~Function + 12 [inlined] (jsi.h:854)
3   Crypto News              ~Function + 12 [inlined] (jsi.h:854)
4   Crypto News              std::__1::__shared_ptr_emplace<facebook::jsi::Function, std::__1::allocator<facebook::jsi::Function> >::__on_zero_shared() + 20 (memory:2644)
5   Crypto News              __release_shared + 40 [inlined] (memory:2549)
6   Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
7   Crypto News              __release_shared + 40 [inlined] (memory:2549)
8   Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
9   Crypto News              ~HostFunctionHandler + 44 [inlined] (HostFunctionHandler.h:11)
10  Crypto News              reanimated::HostFunctionHandler::~HostFunctionHandler() + 60 (HostFunctionHandler.h:11)
11  Crypto News              __release_shared + 40 [inlined] (memory:2549)
12  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
13  Crypto News              reanimated::HostFunctionWrapper::~HostFunctionWrapper() + 36 (ValueWrapper.h:74)
14  Crypto News              ~ShareableValue + 64 [inlined] (ShareableValue.h:23)
15  Crypto News              ~ShareableValue + 64 [inlined] (ShareableValue.h:23)
16  Crypto News              reanimated::ShareableValue::~ShareableValue() + 80 (ShareableValue.h:23)
17  Crypto News              __release_shared + 40 [inlined] (memory:2549)
18  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
19  Crypto News              __is_long + 0 [inlined] (string:1462)
20  Crypto News              ~basic_string + 0 [inlined] (string:2236)
21  Crypto News              ~basic_string + 0 [inlined] (string:2232)
22  Crypto News              ~pair + 8 [inlined] (utility:297)
23  Crypto News              ~pair + 8 [inlined] (utility:297)
24  Crypto News              destroy<std::pair<const std::string, std::shared_ptr<reanimated::ShareableValue> >, void, void> + 24 (allocator_traits.h:317)
25  Crypto News              __libcpp_operator_delete<void *> + 0 [inlined] (new:245)
26  Crypto News              __do_deallocate_handle_size<> + 0 [inlined] (new:269)
27  Crypto News              __libcpp_deallocate + 0 [inlined] (new:279)
28  Crypto News              deallocate + 0 [inlined] (memory:879)
29  Crypto News              deallocate + 0 [inlined] (allocator_traits.h:280)
30  Crypto News              std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> > > >::__deallocate_node(std::__1::__hash_node_base<std::__1::__hash_node<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, void*>*>*) + 32 (__hash_table:1581)
31  Crypto News              reset + 0 [inlined] (memory:1919)
32  Crypto News              ~unique_ptr + 0 [inlined] (memory:1866)
33  Crypto News              ~unique_ptr + 0 [inlined] (memory:1866)
34  Crypto News              std::__1::__hash_table<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, std::__1::__unordered_map_hasher<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::__unordered_map_equal<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >, true>, std::__1::allocator<std::__1::__hash_value_type<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::shared_ptr<reanimated::ShareableValue> > > >::~__hash_table() + 24 (__hash_table:1523)
35  Crypto News              ~FrozenObject + 36 [inlined] (FrozenObject.h:16)
36  Crypto News              reanimated::FrozenObject::~FrozenObject() + 52 (FrozenObject.h:16)
37  Crypto News              __release_shared + 40 [inlined] (memory:2549)
38  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
39  Crypto News              reanimated::FrozenObjectWrapper::~FrozenObjectWrapper() + 36 (ValueWrapper.h:82)
40  Crypto News              ~ShareableValue + 64 [inlined] (ShareableValue.h:23)
41  Crypto News              ~ShareableValue + 64 [inlined] (ShareableValue.h:23)
42  Crypto News              reanimated::ShareableValue::~ShareableValue() + 80 (ShareableValue.h:23)
43  Crypto News              __release_shared + 40 [inlined] (memory:2549)
44  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
45  Crypto News              __destruct_at_end + 20 [inlined] (vector:427)
46  Crypto News              clear + 20 [inlined] (vector:371)
47  Crypto News              std::__1::__vector_base<std::__1::shared_ptr<facebook::jsi::Value>, std::__1::allocator<std::__1::shared_ptr<facebook::jsi::Value> > >::~__vector_base() + 44 (vector:465)
48  Crypto News              reanimated::FrozenArrayWrapper::~FrozenArrayWrapper() + 36 (ValueWrapper.h:96)
49  Crypto News              ~ShareableValue + 64 [inlined] (ShareableValue.h:23)
50  Crypto News              ~ShareableValue + 64 [inlined] (ShareableValue.h:23)
51  Crypto News              reanimated::ShareableValue::~ShareableValue() + 80 (ShareableValue.h:23)
52  Crypto News              __release_shared + 40 [inlined] (memory:2549)
53  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
54  Crypto News              ~MutableValue + 56 [inlined] (MutableValue.h:18)
55  Crypto News              reanimated::MutableValue::~MutableValue() + 72 (MutableValue.h:18)
56  Crypto News              __release_shared + 40 [inlined] (memory:2549)
57  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
58  Crypto News              ~DecoratedHostObject + 20 [inlined] (decorator.h:57)
59  Crypto News              facebook::jsi::DecoratedHostObject::~DecoratedHostObject() + 36 (decorator.h:57)
60  hermes                   std::__1::__shared_weak_count::__release_shared() + 16 [inlined] (shared_ptr.h:220)
61  hermes                   std::__1::shared_ptr<facebook::jsi::HostObject>::~shared_ptr() + 16 [inlined] (shared_ptr.h:959)
62  hermes                   std::__1::shared_ptr<facebook::jsi::HostObject>::~shared_ptr() + 16 [inlined] (shared_ptr.h:957)
63  hermes                   facebook::hermes::HermesRuntimeImpl::JsiProxy::~JsiProxy() + 16 [inlined] (hermes.cpp:798)
64  hermes                   facebook::hermes::HermesRuntimeImpl::JsiProxy::~JsiProxy() + 16 [inlined] (hermes.cpp:798)
65  hermes                   facebook::hermes::HermesRuntimeImpl::JsiProxy::~JsiProxy() + 96 (hermes.cpp:798)
66  hermes                   hermes::vm::KindAndSize::getSize() const + 0 [inlined] (GCCell.h:42)
67  hermes                   hermes::vm::GCCell::getAllocatedSize() const + 0 [inlined] (GCCell.h:113)
68  hermes                   hermes::vm::GCCell::nextCell() + 0 [inlined] (GCCell.h:222)
69  hermes                   hermes::vm::AlignedHeapSegment::HeapCellIterator::operator++() + 0 [inlined] (AlignedHeapSegment.h:142)
70  hermes                   void hermes::vm::HadesGC::HeapSegment::forAllObjs<hermes::vm::HadesGC::finalizeAll()::$_2>(hermes::vm::HadesGC::finalizeAll()::$_2) + 80 [inlined] (HadesGC.cpp:196)
71  hermes                   hermes::vm::HadesGC::finalizeAll() + 520 (HadesGC.cpp:1918)
72  hermes                   hermes::vm::Runtime::~Runtime() + 100 (Runtime.cpp:388)
73  hermes                   hermes::vm::Runtime::~Runtime() + 12 (Runtime.cpp:378)
74  hermes                   std::__1::__shared_weak_count::__release_shared() + 16 [inlined] (shared_ptr.h:220)
75  hermes                   std::__1::shared_ptr<hermes::vm::Runtime>::~shared_ptr() + 16 [inlined] (shared_ptr.h:959)
76  hermes                   std::__1::shared_ptr<hermes::vm::Runtime>::~shared_ptr() + 16 [inlined] (shared_ptr.h:957)
77  hermes                   facebook::hermes::HermesRuntimeImpl::~HermesRuntimeImpl() + 212 (hermes.cpp:279)
78  hermes                   facebook::hermes::HermesRuntimeImpl::~HermesRuntimeImpl() + 12 (hermes.cpp:273)
79  Crypto News              __release_shared + 40 [inlined] (memory:2549)
80  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
81  Crypto News              ~RuntimeDecorator + 0 [inlined] (decorator.h:100)
82  Crypto News              ~WithRuntimeDecorator + 0 [inlined] (decorator.h:480)
83  Crypto News              ~DecoratedRuntime + 44 [inlined] (HermesExecutorFactory.cpp:183)
84  Crypto News              facebook::react::(anonymous namespace)::DecoratedRuntime::~DecoratedRuntime() + 64 (HermesExecutorFactory.cpp:177)
85  Crypto News              __release_shared + 40 [inlined] (memory:2549)
86  Crypto News              std::__1::shared_ptr<reanimated::MutableValue>::~shared_ptr() + 64 (memory:3238)
87  Crypto News              facebook::react::JSIExecutor::~JSIExecutor() + 272 (JSIExecutor.h:71)
88  Crypto News              facebook::react::HermesExecutor::~HermesExecutor() + 84 (HermesExecutorFactory.h:49)
89  Crypto News              facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (functional)
90  Crypto News              facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&) + 24 (RCTMessageThread.mm)
91  Crypto News              ~__value_func + 0 [inlined] (functional:1843)
92  Crypto News              ~__value_func + 0 [inlined] (functional:1842)
93  Crypto News              ~function + 0 [inlined] (functional:2547)
94  Crypto News              ~function + 0 [inlined] (functional:2547)
95  Crypto News              facebook::react::RCTMessageThread::runOnQueueSync(std::__1::function<void ()>&&) + 164 (RCTMessageThread.mm:92)
96  Crypto News              ~__value_func + 0 [inlined] (functional:1843)
97  Crypto News              ~__value_func + 0 [inlined] (functional:1842)
98  Crypto News              ~function + 0 [inlined] (functional:2547)
99  Crypto News              ~function + 0 [inlined] (functional:2547)
100 Crypto News              facebook::react::NativeToJsBridge::destroy() + 88 (NativeToJsBridge.cpp:285)
101 Crypto News              facebook::react::Instance::~Instance() + 36 (Instance.cpp:40)
102 Crypto News              operator() + 8 [inlined] (memory:1428)
103 Crypto News              std::__1::__shared_ptr_pointer<facebook::react::Instance*, std::__1::shared_ptr<facebook::react::Instance>::__shared_ptr_default_delete<facebook::react::Instance, facebook::react::Instance>, std::__1::allocator<facebook::react::Instance> >::__on_zero_shared() + 20 (memory:2596)
104 Crypto News              __release_shared + 40 [inlined] (memory:2549)
105 Crypto News              ~shared_ptr + 44 [inlined] (memory:3238)
106 Crypto News              ~shared_ptr + 44 [inlined] (memory:3236)
107 Crypto News              reset + 52 [inlined] (memory:3333)
108 Crypto News              __26-[RCTCxxBridge invalidate]_block_invoke + 1060 (RCTCxxBridge.mm:1302)
109 Crypto News              facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (functional)
110 Crypto News              -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm)
111 Foundation               __NSThreadPerformPerform + 184
112 CoreFoundation           __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
113 CoreFoundation           __CFRunLoopDoSource0 + 204
114 CoreFoundation           __CFRunLoopDoSources0 + 256
115 CoreFoundation           __CFRunLoopRun + 768
116 CoreFoundation           CFRunLoopRunSpecific + 572
117 Crypto News              +[RCTCxxBridge runRunLoop] + 264 (RCTCxxBridge.mm)
118 Foundation               __NSThread__start__ + 848
119 libsystem_pthread.dylib  _pthread_start + 288

#0. Thread
0  libsystem_kernel.dylib  mach_msg_trap + 8
1  libsystem_kernel.dylib  mach_msg + 72
2  CoreFoundation          __CFRunLoopServiceMachPort + 368
3  CoreFoundation          __CFRunLoopRun + 1184
4  CoreFoundation          CFRunLoopRunSpecific + 572
5  GraphicsServices        GSEventRunModal + 160
6  UIKitCore               -[UIApplication _run] + 1052
7  UIKitCore               UIApplicationMain + 164
8  Crypto News             main + 88 (main.m:8)
9  libdyld.dylib           start + 4

#1. com.apple.uikit.eventfetch-thread
0  libsystem_kernel.dylib   mach_msg_trap + 8
1  libsystem_kernel.dylib   mach_msg + 72
2  CoreFoundation           __CFRunLoopServiceMachPort + 368
3  CoreFoundation           __CFRunLoopRun + 1184
4  CoreFoundation           CFRunLoopRunSpecific + 572
5  Foundation               -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 228
6  Foundation               -[NSRunLoop(NSRunLoop) runUntilDate:] + 88
7  UIKitCore                -[UIEventFetcher threadMain] + 504
8  Foundation               __NSThread__start__ + 848
9  libsystem_pthread.dylib  _pthread_start + 288

#2. com.google.firebase.crashlytics.MachExceptionServer
0  libsystem_kernel.dylib   mach_msg_trap + 8
1  libsystem_kernel.dylib   mach_msg + 72
2  Crypto News              FIRCLSMachExceptionReadMessage + 56 [inlined] (FIRCLSMachException.c)
3  Crypto News              FIRCLSMachExceptionServer + 104 (FIRCLSMachException.c:168)
4  libsystem_pthread.dylib  _pthread_start + 288

#4. hades
0  libsystem_kernel.dylib   __psynch_cvwait + 8
1  libsystem_pthread.dylib  _pthread_cond_wait$VARIANT$mp + 1236
2  libc++.1.dylib           std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  hermes                   std::__1::deque<std::__1::function<void ()>, std::__1::allocator<std::__1::function<void ()> > >::empty() const + 0 [inlined] (deque:1407)
4  hermes                   hermes::vm::HadesGC::Executor::worker()::'lambda'()::operator()() const + 0 [inlined] (HadesGC.cpp:1081)
5  hermes                   void std::__1::condition_variable::wait<hermes::vm::HadesGC::Executor::worker()::'lambda'()>(std::__1::unique_lock<std::__1::mutex>&, hermes::vm::HadesGC::Executor::worker()::'lambda'()) + 12 [inlined] (__mutex_base:403)
6  hermes                   hermes::vm::HadesGC::Executor::worker() + 544 (HadesGC.cpp:1081)
7  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::reset(std::__1::__thread_struct*) + 0 [inlined] (unique_ptr.h:315)
8  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
9  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
10 hermes                   std::__1::__tuple_leaf<0ul, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, false>::~__tuple_leaf() + 0 [inlined] (tuple:191)
11 hermes                   std::__1::__tuple_impl<std::__1::__tuple_indices<0ul, 1ul>, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~__tuple_impl() + 0 [inlined] (tuple:365)
12 hermes                   std::__1::__tuple_impl<std::__1::__tuple_indices<0ul, 1ul>, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~__tuple_impl() + 0 [inlined] (tuple:365)
13 hermes                   std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~tuple() + 0 [inlined] (tuple:451)
14 hermes                   std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~tuple() + 0 [inlined] (tuple:451)
15 hermes                   std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >::operator()(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>*) const + 0 [inlined] (unique_ptr.h:57)
16 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::reset(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>*) + 0 [inlined] (unique_ptr.h:318)
17 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
18 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
19 hermes                   void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >(void*) + 44 (thread:300)
20 libsystem_pthread.dylib  _pthread_start + 288

#5. com.apple.NSURLConnectionLoader
0  libsystem_kernel.dylib   mach_msg_trap + 8
1  libsystem_kernel.dylib   mach_msg + 72
2  CoreFoundation           __CFRunLoopServiceMachPort + 368
3  CoreFoundation           __CFRunLoopRun + 1184
4  CoreFoundation           CFRunLoopRunSpecific + 572
5  CFNetwork                (Missing)
6  Foundation               __NSThread__start__ + 848
7  libsystem_pthread.dylib  _pthread_start + 288

#6. AVAudioSession Notify Thread
0  libsystem_kernel.dylib   mach_msg_trap + 8
1  libsystem_kernel.dylib   mach_msg + 72
2  CoreFoundation           __CFRunLoopServiceMachPort + 368
3  CoreFoundation           __CFRunLoopRun + 1184
4  CoreFoundation           CFRunLoopRunSpecific + 572
5  AudioSession             GenericRunLoopThread::Entry(void*) + 156
6  AudioSession             CAPThread::Entry(CAPThread*) + 88
7  libsystem_pthread.dylib  _pthread_start + 288

#7. JavaScriptCore bmalloc scavenger
0  libsystem_kernel.dylib   __psynch_cvwait + 8
1  libsystem_pthread.dylib  _pthread_cond_wait$VARIANT$mp + 1236
2  libc++.1.dylib           std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  JavaScriptCore           void std::__1::condition_variable_any::wait<std::__1::unique_lock<bmalloc::Mutex> >(std::__1::unique_lock<bmalloc::Mutex>&) + 108
4  JavaScriptCore           bmalloc::Scavenger::threadRunLoop() + 252
5  JavaScriptCore           bmalloc::Scavenger::Scavenger(std::__1::scoped_lock<bmalloc::Mutex> const&) + 0
6  JavaScriptCore           std::__1::__thread_specific_ptr<std::__1::__thread_struct>::set_pointer(std::__1::__thread_struct*) + 0
7  libsystem_pthread.dylib  _pthread_start + 288

#8. Thread
0  libsystem_kernel.dylib   __workq_kernreturn + 8
1  libsystem_pthread.dylib  _pthread_wqthread + 348

#9. Thread
0  libsystem_kernel.dylib   __semwait_signal + 8
1  libsystem_c.dylib        nanosleep + 212
2  libsystem_c.dylib        sleep + 44
3  Crypto News              monitorCachedData + 756
4  libsystem_pthread.dylib  _pthread_start + 288

#10. KSCrash Exception Handler (Secondary)
0  libsystem_kernel.dylib   mach_msg_trap + 8
1  libsystem_kernel.dylib   mach_msg + 72
2  Crypto News              handleExceptions + 172
3  libsystem_pthread.dylib  _pthread_start + 288

#11. KSCrash Exception Handler (Primary)
0  (Missing)  (Missing)

#12. Thread
0  libsystem_kernel.dylib   __accept + 8
1  Crypto News              __async_wait_block_invoke + 112
2  Crypto News              __28-[YMMAsyncExecutor execute:]_block_invoke + 36
3  libdispatch.dylib        _dispatch_call_block_and_release + 24
4  libdispatch.dylib        _dispatch_client_callout + 16
5  libdispatch.dylib        _dispatch_lane_serial_drain$VARIANT$mp + 612
6  libdispatch.dylib        _dispatch_lane_invoke$VARIANT$mp + 420
7  libdispatch.dylib        _dispatch_workloop_worker_thread + 712
8  libsystem_pthread.dylib  _pthread_wqthread + 272

#13. Thread
0  libsystem_kernel.dylib   __workq_kernreturn + 8
1  libsystem_pthread.dylib  _pthread_wqthread + 348

#14. Thread
0  libsystem_kernel.dylib   __workq_kernreturn + 8
1  libsystem_pthread.dylib  _pthread_wqthread + 348

#15. Thread
0  libsystem_kernel.dylib   __workq_kernreturn + 8
1  libsystem_pthread.dylib  _pthread_wqthread + 348

#16. Thread
0  libsystem_kernel.dylib   __workq_kernreturn + 8
1  libsystem_pthread.dylib  _pthread_wqthread + 348

#17. Thread
0  libsystem_kernel.dylib   __semwait_signal + 8
1  libsystem_c.dylib        nanosleep + 212
2  Foundation               +[NSThread sleepForTimeInterval:] + 152
3  Crypto News              __24-[RealmReact setBridge:]_block_invoke + 200 (RealmReact.mm:150)
4  Crypto News              facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (functional)
5  Crypto News              -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm)
6  Foundation               __NSThreadPerformPerform + 184
7  CoreFoundation           __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 24
8  CoreFoundation           __CFRunLoopDoSource0 + 204
9  CoreFoundation           __CFRunLoopDoSources0 + 256
10 CoreFoundation           __CFRunLoopRun + 768
11 CoreFoundation           CFRunLoopRunSpecific + 572
12 Crypto News              +[RCTCxxBridge runRunLoop] + 264 (RCTCxxBridge.mm)
13 Foundation               __NSThread__start__ + 848
14 libsystem_pthread.dylib  _pthread_start + 288

#18. Thread
0  libsystem_kernel.dylib   __psynch_cvwait + 8
1  libsystem_pthread.dylib  _pthread_cond_wait$VARIANT$mp + 1236
2  libc++.1.dylib           std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  hermes                   std::__1::deque<std::__1::function<void ()>, std::__1::allocator<std::__1::function<void ()> > >::empty() const + 0 [inlined] (deque:1407)
4  hermes                   hermes::vm::HadesGC::Executor::worker()::'lambda'()::operator()() const + 0 [inlined] (HadesGC.cpp:1081)
5  hermes                   void std::__1::condition_variable::wait<hermes::vm::HadesGC::Executor::worker()::'lambda'()>(std::__1::unique_lock<std::__1::mutex>&, hermes::vm::HadesGC::Executor::worker()::'lambda'()) + 12 [inlined] (__mutex_base:403)
6  hermes                   hermes::vm::HadesGC::Executor::worker() + 544 (HadesGC.cpp:1081)
7  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::reset(std::__1::__thread_struct*) + 0 [inlined] (unique_ptr.h:315)
8  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
9  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
10 hermes                   std::__1::__tuple_leaf<0ul, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, false>::~__tuple_leaf() + 0 [inlined] (tuple:191)
11 hermes                   std::__1::__tuple_impl<std::__1::__tuple_indices<0ul, 1ul>, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~__tuple_impl() + 0 [inlined] (tuple:365)
12 hermes                   std::__1::__tuple_impl<std::__1::__tuple_indices<0ul, 1ul>, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~__tuple_impl() + 0 [inlined] (tuple:365)
13 hermes                   std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~tuple() + 0 [inlined] (tuple:451)
14 hermes                   std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~tuple() + 0 [inlined] (tuple:451)
15 hermes                   std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >::operator()(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>*) const + 0 [inlined] (unique_ptr.h:57)
16 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::reset(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>*) + 0 [inlined] (unique_ptr.h:318)
17 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
18 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
19 hermes                   void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >(void*) + 44 (thread:300)
20 libsystem_pthread.dylib  _pthread_start + 288

#19. Thread
0  libsystem_kernel.dylib   __psynch_cvwait + 8
1  libsystem_pthread.dylib  _pthread_cond_wait$VARIANT$mp + 1236
2  libc++.1.dylib           std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  Crypto News              wait<(lambda at /Users/sergeypavlov/projs/mp_cryptonews/node_modules/react-native/ReactCommon/hermes/inspector/detail/SerialExecutor.cpp:41:26)> + 28 [inlined] (__mutex_base)
4  Crypto News              facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41)
5  Crypto News              ~__value_func + 0 [inlined] (functional:1843)
6  Crypto News              ~__value_func + 0 [inlined] (functional:1842)
7  Crypto News              ~function + 0 [inlined] (functional:2547)
8  Crypto News              ~function + 0 [inlined] (functional:2547)
9  Crypto News              __invoke<void (*)(std::string, std::function<void ()>), std::string, std::function<void ()> > + 52 [inlined] (type_traits:3694)
10 Crypto News              __thread_execute<std::unique_ptr<std::__thread_struct>, void (*)(std::string, std::function<void ()>), std::string, std::function<void ()> , 2, 3> + 56 [inlined] (thread:286)
11 Crypto News              __thread_proxy<std::tuple<std::unique_ptr<std::__thread_struct>, void (*)(std::string, std::function<void ()>), std::string, std::function<void ()> > > + 120 (thread:297)
12 libsystem_pthread.dylib  _pthread_start + 288

#20. Thread
0  libsystem_kernel.dylib   __psynch_cvwait + 8
1  libsystem_pthread.dylib  _pthread_cond_wait$VARIANT$mp + 1236
2  libc++.1.dylib           std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  Crypto News              wait<(lambda at /Users/sergeypavlov/projs/mp_cryptonews/node_modules/react-native/ReactCommon/hermes/inspector/detail/SerialExecutor.cpp:41:26)> + 28 [inlined] (__mutex_base)
4  Crypto News              facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41)
5  Crypto News              ~__value_func + 0 [inlined] (functional:1843)
6  Crypto News              ~__value_func + 0 [inlined] (functional:1842)
7  Crypto News              ~function + 0 [inlined] (functional:2547)
8  Crypto News              ~function + 0 [inlined] (functional:2547)
9  Crypto News              __invoke<void (*)(std::string, std::function<void ()>), std::string, std::function<void ()> > + 52 [inlined] (type_traits:3694)
10 Crypto News              __thread_execute<std::unique_ptr<std::__thread_struct>, void (*)(std::string, std::function<void ()>), std::string, std::function<void ()> , 2, 3> + 56 [inlined] (thread:286)
11 Crypto News              __thread_proxy<std::tuple<std::unique_ptr<std::__thread_struct>, void (*)(std::string, std::function<void ()>), std::string, std::function<void ()> > > + 120 (thread:297)
12 libsystem_pthread.dylib  _pthread_start + 288

#21. Thread
0  libsystem_kernel.dylib   __psynch_cvwait + 8
1  libsystem_pthread.dylib  _pthread_cond_wait$VARIANT$mp + 1236
2  libc++.1.dylib           std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 24
3  hermes                   std::__1::deque<std::__1::function<void ()>, std::__1::allocator<std::__1::function<void ()> > >::empty() const + 0 [inlined] (deque:1407)
4  hermes                   hermes::vm::HadesGC::Executor::worker()::'lambda'()::operator()() const + 0 [inlined] (HadesGC.cpp:1081)
5  hermes                   void std::__1::condition_variable::wait<hermes::vm::HadesGC::Executor::worker()::'lambda'()>(std::__1::unique_lock<std::__1::mutex>&, hermes::vm::HadesGC::Executor::worker()::'lambda'()) + 12 [inlined] (__mutex_base:403)
6  hermes                   hermes::vm::HadesGC::Executor::worker() + 544 (HadesGC.cpp:1081)
7  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::reset(std::__1::__thread_struct*) + 0 [inlined] (unique_ptr.h:315)
8  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
9  hermes                   std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
10 hermes                   std::__1::__tuple_leaf<0ul, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, false>::~__tuple_leaf() + 0 [inlined] (tuple:191)
11 hermes                   std::__1::__tuple_impl<std::__1::__tuple_indices<0ul, 1ul>, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~__tuple_impl() + 0 [inlined] (tuple:365)
12 hermes                   std::__1::__tuple_impl<std::__1::__tuple_indices<0ul, 1ul>, std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~__tuple_impl() + 0 [inlined] (tuple:365)
13 hermes                   std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~tuple() + 0 [inlined] (tuple:451)
14 hermes                   std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>::~tuple() + 0 [inlined] (tuple:451)
15 hermes                   std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >::operator()(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>*) const + 0 [inlined] (unique_ptr.h:57)
16 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::reset(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>*) + 0 [inlined] (unique_ptr.h:318)
17 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
18 hermes                   std::__1::unique_ptr<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()>, std::__1::default_delete<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> > >::~unique_ptr() + 0 [inlined] (unique_ptr.h:272)
19 hermes                   void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, hermes::vm::HadesGC::Executor::Executor()::'lambda'()> >(void*) + 44 (thread:300)
20 libsystem_pthread.dylib  _pthread_start + 288

Steps to reproduce

Calling RNRestart.Restart() occasionally causes app to crash

Snack or a link to a repository

https://snack.expo.dev/_ebtB9FfH

Reanimated version

2.12.0

React Native version

0.70.2

Platforms

iOS

JavaScript runtime

Hermes

Workflow

React Native (without Expo)

Architecture

Paper (Old Architecture)

Build type

None

Device

Real device

Device model

No response

Acknowledgements

Yes

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 11
  • Comments: 36 (4 by maintainers)

Most upvoted comments

hello!

I noticed the same, but with CodePush, but root cause - load new bundle - is the same in our cases. The issue is exactly here, exactly when new bundle is loaded and when at least one worklet was mounted before restart:

#pragma once

#include <jsi/jsi.h>
#include <memory>
#include <string>

using namespace facebook;

namespace reanimated {

struct HostFunctionHandler : jsi::HostObject {
  std::shared_ptr<jsi::Function> pureFunction;
  std::string functionName;
  jsi::Runtime *hostRuntime;
  jsi::HostObject a;

  HostFunctionHandler(std::shared_ptr<jsi::Function> f, jsi::Runtime &rt) {
    pureFunction = f; <------ HERE!!
    functionName = f->getProperty(rt, "name").asString(rt).utf8(rt);
    hostRuntime = &rt;
  }

  std::shared_ptr<jsi::Function> getPureFunction() {
    return pureFunction;
  }
};

} // namespace reanimated

this file is here: image

It’ reproducible in 100% by steps:

  • mount any worklet
  • reload app by any lib (that’s mean load bundle again)

I’ll appreciate any tips, and please let me know if anyone needs any details. I’ll provide demo soon

UPDATE: in this case it was runOnJS function in gesture detector

These may be related: https://github.com/software-mansion/react-native-reanimated/issues/4341

@efstathiosntonas 's reply prompted me to look for memory leaks, and sure enough, there are memory leaks of objects related to gestures. See this screenshot Screenshot 2023-04-11 at 4 05 51 PM

The crash and the memory leaks coincide. I notice that I only get the crashes when I have a Gesture handler that calls an outside function with runOnJS(). When I remove that function call, I don’t get the crash or the memory leaks. So the memory leak is likely the problem.

The “runOnJS()” fix also worked for me, but I have another issue where I rely on onTouchesMoved, which doesn’t work with runOnJS().

Not having Codepush because of this bug is really killing me atm. And I can’t upgrade to v3 because it introduces tons of bugs in my app.

I’m not using runOnJs in my app and that bug still happens.

Can confirm it is still an issue on the latest version.

yes but it’s no ideal solution, you can add .runOnJS(true) at the end of Gesture builder (similar to onBegin / onEnd)

This appears to still be an issue with CodePush. On CodePush installs, the app will crash with EXC_BAD_ACCESS . I am using the latest versions of react-native, react-native-reanimated, react-native-code-push, and react-native-screens. This issue only happens on physical devices.

0   Ranked                        	       0x104bc21fc reanimated::ShareableRemoteFunction::~ShareableRemoteFunction() + 2384380 (Shareables.h:316)
1   Ranked                        	       0x104bbe784 std::__1::shared_ptr<reanimated::ShareableRemoteFunction>::~shared_ptr[abi:v15006]() + 2369412 (shared_ptr.h:702)
2   Ranked                        	       0x104bbfa78 std::__1::__function::__func<reanimated::NativeReanimatedModule::NativeReanimatedModule(std::__1::shared_ptr<facebook::react::CallInvoker> const&, std::__1::shared_ptr<reanimated::Scheduler> const&, std::__1::shared_ptr<facebook::jsi::Runtime> const&, std::__1::shared_ptr<reanimated::ErrorHandler> const&, std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, int, facebook::jsi::String const&)>, reanimated::PlatformDepMethodsHolder)::$_1::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const&) const::'lambda'(), std::__1::allocator<reanimated::NativeReanimatedModule::NativeReanimatedModule(std::__1::shared_ptr<facebook::react::CallInvoker> const&, std::__1::shared_ptr<reanimated::Scheduler> const&, std::__1::shared_ptr<facebook::jsi::Runtime> const&, std::__1::shared_ptr<reanimated::ErrorHandler> const&, std::__1::function<facebook::jsi::Value (facebook::jsi::Runtime&, int, facebook::jsi::String const&)>, reanimated::PlatformDepMethodsHolder)::$_1::operator()(facebook::jsi::Runtime&, facebook::jsi::Value const&, facebook::jsi::Value const&) const::'lambda'()>, void ()>::destroy_deallocate() + 2374264 (function.h:352)
3   Ranked                        	       0x104cedd18 std::__1::__function::__func<facebook::react::Instance::JSCallInvoker::scheduleAsync(std::__1::function<void ()>&&)::$_3, std::__1::allocator<facebook::react::Instance::JSCallInvoker::scheduleAsync(std::__1::function<void ()>&&)::$_3>, void (facebook::react::JSExecutor*)>::destroy_deallocate() + 3611928 (function.h:352)
4   Ranked                        	       0x104cf76d4 std::__1::__function::__alloc_func<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8, std::__1::allocator<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8>, void ()>::destroy[abi:v15006]() + 3651284 (function.h:204)
5   Ranked                        	       0x104cf7520 std::__1::__function::__func<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8, std::__1::allocator<facebook::react::NativeToJsBridge::runOnExecutorQueue(std::__1::function<void (facebook::react::JSExecutor*)>)::$_8>, void ()>::destroy_deallocate() + 3650848 (function.h:352)
6   Ranked                        	       0x104c582f8 std::__1::shared_ptr<std::__1::function<void ()>>::~shared_ptr[abi:v15006]() + 2999032 (shared_ptr.h:702)
7   Ranked                        	       0x104c58710 std::__1::__function::__func<facebook::react::RCTMessageThread::runOnQueue(std::__1::function<void ()>&&)::$_1, std::__1::allocator<facebook::react::RCTMessageThread::runOnQueue(std::__1::function<void ()>&&)::$_1>, void ()>::destroy_deallocate() + 3000080 (function.h:351)
8   libsystem_blocks.dylib        	       0x21d5bd134 _call_dispose_helpers_excp + 48
9   libsystem_blocks.dylib        	       0x21d5bcd64 _Block_release + 252
10  CoreFoundation                	       0x1bd8e1238 __CFRunLoopDoBlocks + 404
11  CoreFoundation                	       0x1bd8b10e8 __CFRunLoopRun + 848
12  CoreFoundation                	       0x1bd8b63ec CFRunLoopRunSpecific + 612
13  Ranked                        	       0x104c42250 +[RCTCxxBridge runRunLoop] + 2908752 (RCTCxxBridge.mm:0)
14  Foundation                    	       0x1b7b50544 __NSThread__start__ + 716
15  libsystem_pthread.dylib       	       0x21d5c16b8 _pthread_start + 148
16  libsystem_pthread.dylib       	       0x21d5c0b88 thread_start + 8```

Yes, fixed in V3!

I can confirm that it’s fixed in v3 (in my case)

The runOnJS hack actually helped with getting rid of crashes on reanimated 2, but due to some issues with layout animation I decided to upgrade it to the latest version as of now (3.0.2), and now the iOS app crashes on restart even more frequently. By my calculations the crash rate is close to 90% now.

The stacktrace if different this time:

Incident Identifier: DC02D8F8-5C0C-46C2-BE31-D9B52A4B2049
Hardware Model:      iPhone14,5
Process:             C News [13625]
Path:                /private/var/containers/Bundle/Application/EAF03ADF-9EFB-4F67-B728-8CF971AF072B/C News.app/C News
Identifier:          com.cnews
Version:             6.0.0 (132)
AppStoreTools:       14E221
AppVariant:          1:iPhone14,5:16
Beta:                YES
Code Type:           ARM-64 (Native)
Role:                Foreground
Parent Process:      launchd [1]
Coalition:           com.cnews [995]

Date/Time:           2023-04-17 19:14:02.5254 +0300
Launch Time:         2023-04-17 16:58:19.1767 +0300
OS Version:          iPhone OS 16.4.1 (20E252)
Release Type:        User
Baseband Version:    2.55.00
Report Version:      104

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Subtype: KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Codes: 0x0000000000000001, 0x0000000000000010
VM Region Info: 0x10 is not in any region.  Bytes before following region: 68719476720
      REGION TYPE                 START - END      [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      UNUSED SPACE AT START
--->  
      commpage (reserved)     1000000000-7000000000 [384.0G] ---/--- SM=NUL  ...(unallocated)
Termination Reason: SIGNAL 11 Segmentation fault: 11
Terminating Process: exc handler [13625]

Triggered by Thread:  0


Kernel Triage:
VM - (arg = 0x0) pmap_enter retried due to resource shortage


Thread 0 name:
Thread 0 Crashed:
0   C News                   	0x00000001009a249c -[REAAnimationsManager viewDidMount:withBeforeSnapshot:withNewFrame:] + 116 (REAAnimationsManager.m:523)
1   C News                   	0x00000001009b06dc __51-[REAUIManager uiBlockWithLayoutUpdateForRootView:]_block_invoke.46 + 1936 (REAUIManager.mm:330)
2   C News                   	0x0000000100a4c4f8 __44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke + 164 (RCTUIManager.m:1199)
3   C News                   	0x0000000100a4c5e8 __44-[RCTUIManager flushUIBlocksWithCompletion:]_block_invoke.146 + 28 (RCTUIManager.m:1219)
4   libdispatch.dylib             	0x00000001bb9ec320 _dispatch_call_block_and_release + 32 (init.c:1518)
5   libdispatch.dylib             	0x00000001bb9edeac _dispatch_client_callout + 20 (object.m:560)
6   libdispatch.dylib             	0x00000001bb9fc6a4 _dispatch_main_queue_drain + 928 (inline_internal.h:2640)
7   libdispatch.dylib             	0x00000001bb9fc2f4 _dispatch_main_queue_callback_4CF + 44 (queue.c:7954)
8   CoreFoundation                	0x00000001b45bdd18 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16 (CFRunLoop.c:1780)
9   CoreFoundation                	0x00000001b459f650 __CFRunLoopRun + 1992 (CFRunLoop.c:3147)
10  CoreFoundation                	0x00000001b45a44dc CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
11  GraphicsServices              	0x00000001ef80435c GSEventRunModal + 164 (GSEvent.c:2196)
12  UIKitCore                     	0x00000001b693037c -[UIApplication _run] + 888 (UIApplication.m:3773)
13  UIKitCore                     	0x00000001b692ffe0 UIApplicationMain + 340 (UIApplication.m:5363)
14  C News                   	0x0000000100784010 main + 80 (main.m:8)
15  dyld                          	0x00000001d3a2cdec start + 2220 (dyldMain.cpp:1165)

Thread 1:
0   libsystem_pthread.dylib       	0x0000000213eafb74 start_wqthread + 0 (:-1)

Thread 2:
0   libsystem_pthread.dylib       	0x0000000213eafb74 start_wqthread + 0 (:-1)

Thread 3:
0   libsystem_pthread.dylib       	0x0000000213eafb74 start_wqthread + 0 (:-1)

Thread 4 name:
Thread 4:
0   libsystem_kernel.dylib        	0x00000001f3231c84 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001f3244b54 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001f3244e2c mach_msg_overwrite + 540 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001f32321c8 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x00000001b459e114 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x00000001b459f340 __CFRunLoopRun + 1208 (CFRunLoop.c:3005)
6   CoreFoundation                	0x00000001b45a44dc CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   Foundation                    	0x00000001ae83e0c4 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 212 (NSRunLoop.m:373)
8   Foundation                    	0x00000001ae83dfac -[NSRunLoop(NSRunLoop) runUntilDate:] + 64 (NSRunLoop.m:420)
9   UIKitCore                     	0x00000001b6a62dac -[UIEventFetcher threadMain] + 416 (UIEventFetcher.m:1376)
10  Foundation                    	0x00000001ae857634 __NSThread__start__ + 716 (NSThread.m:963)
11  libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
12  libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 5 name:
Thread 5:
0   libsystem_kernel.dylib        	0x00000001f3233658 write + 8 (:-1)
1   C News                   	0x00000001007dcadc FIRCLSSDKFileLog + 316 (FIRCLSInternalLogging.c:0)
2   C News                   	0x00000001007de6ac FIRCLSMachExceptionReply + 128 (FIRCLSMachException.c:265)
3   C News                   	0x00000001007de6ac FIRCLSMachExceptionServer + 968 (FIRCLSMachException.c:176)
4   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
5   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 6 name:
Thread 6:
0   libsystem_kernel.dylib        	0x00000001f32327bc __ulock_wait + 8 (:-1)
1   libdispatch.dylib             	0x00000001bb9ee89c _dlock_wait + 56 (lock.c:326)
2   libdispatch.dylib             	0x00000001bb9ee650 _dispatch_thread_event_wait_slow + 56 (lock.c:368)
3   libdispatch.dylib             	0x00000001bb9fd714 __DISPATCH_WAIT_FOR_QUEUE__ + 368 (lock.h:330)
4   libdispatch.dylib             	0x00000001bb9fd2c0 _dispatch_sync_f_slow + 148 (queue.c:1769)
5   C News                   	0x0000000100a50824 RCTUnsafeExecuteOnMainQueueSync + 132 (RCTUtils.m:277)
6   C News                   	0x00000001009a506c -[REAKeyboardEventObserver clearListeners] + 68 (REAKeyboardEventObserver.m:224)
7   CoreFoundation                	0x00000001b455c670 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148 (CFNotificationCenter.c:661)
8   CoreFoundation                	0x00000001b4600910 ___CFXRegistrationPost_block_invoke + 88 (CFNotificationCenter.c:175)
9   CoreFoundation                	0x00000001b45e39a8 _CFXRegistrationPost + 440 (CFNotificationCenter.c:201)
10  CoreFoundation                	0x00000001b4570bdc _CFXNotificationPost + 700 (CFNotificationCenter.c:1193)
11  Foundation                    	0x00000001ae858e28 -[NSNotificationCenter postNotificationName:object:userInfo:] + 92 (NSNotification.m:518)
12  C News                   	0x0000000100a108ec __26-[RCTCxxBridge invalidate]_block_invoke + 808 (RCTCxxBridge.mm:1298)
13  C News                   	0x0000000100a15f2c std::__1::__function::__value_func<void ()>::operator()() const + 20 (function.h:505)
14  C News                   	0x0000000100a15f2c std::__1::function<void ()>::operator()() const + 20 (function.h:1182)
15  C News                   	0x0000000100a15f2c facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74)
16  C News                   	0x0000000100a0c090 -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm:344)
17  Foundation                    	0x00000001ae83789c __NSThreadPerformPerform + 264 (NSThread.m:255)
18  CoreFoundation                	0x00000001b45f8208 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
19  CoreFoundation                	0x00000001b4604864 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
20  CoreFoundation                	0x00000001b45896c8 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
21  CoreFoundation                	0x00000001b459f1c4 __CFRunLoopRun + 828 (CFRunLoop.c:2953)
22  CoreFoundation                	0x00000001b45a44dc CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
23  C News                   	0x0000000100a0bfc8 +[RCTCxxBridge runRunLoop] + 212 (RCTCxxBridge.mm:335)
24  Foundation                    	0x00000001ae857634 __NSThread__start__ + 716 (NSThread.m:963)
25  libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
26  libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 7 name:
Thread 7:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   hermes                        	0x00000001022855ac 0x102168000 + 1168812
4   hermes                        	0x0000000102285360 0x102168000 + 1168224
5   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 8 name:
Thread 8:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   hermes                        	0x00000001022855ac 0x102168000 + 1168812
4   hermes                        	0x0000000102285360 0x102168000 + 1168224
5   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 9 name:
Thread 9:
0   libsystem_kernel.dylib        	0x00000001f3231c84 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001f3244b54 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001f3244e2c mach_msg_overwrite + 540 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001f32321c8 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x00000001b459e114 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x00000001b459f340 __CFRunLoopRun + 1208 (CFRunLoop.c:3005)
6   CoreFoundation                	0x00000001b45a44dc CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   CFNetwork                     	0x00000001b578e7e0 +[__CFN_CoreSchedulingSetRunnable _run:] + 392 (CoreSchedulingSet.mm:1372)
8   Foundation                    	0x00000001ae857634 __NSThread__start__ + 716 (NSThread.m:963)
9   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
10  libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 10:
0   libsystem_pthread.dylib       	0x0000000213eafb74 start_wqthread + 0 (:-1)

Thread 11:
0   libsystem_pthread.dylib       	0x0000000213eafb74 start_wqthread + 0 (:-1)

Thread 12 name:
Thread 12:
0   libsystem_kernel.dylib        	0x00000001f323f848 __accept + 8 (:-1)
1   C News                   	0x00000001013d6168 __async_wait_block_invoke + 112
2   C News                   	0x00000001013c4568 __28-[YMMAsyncExecutor execute:]_block_invoke + 36
3   libdispatch.dylib             	0x00000001bb9ec320 _dispatch_call_block_and_release + 32 (init.c:1518)
4   libdispatch.dylib             	0x00000001bb9edeac _dispatch_client_callout + 20 (object.m:560)
5   libdispatch.dylib             	0x00000001bb9f5534 _dispatch_lane_serial_drain + 668 (inline_internal.h:2640)
6   libdispatch.dylib             	0x00000001bb9f60a4 _dispatch_lane_invoke + 384 (queue.c:3966)
7   libdispatch.dylib             	0x00000001bba00cdc _dispatch_workloop_worker_thread + 648 (queue.c:6913)
8   libsystem_pthread.dylib       	0x0000000213eafddc _pthread_wqthread + 288 (pthread.c:2618)
9   libsystem_pthread.dylib       	0x0000000213eafb7c start_wqthread + 8 (:-1)

Thread 13 name:
Thread 13:
0   libsystem_kernel.dylib        	0x00000001f3231c84 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001f3244b54 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001f3244e2c mach_msg_overwrite + 540 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001f32321c8 mach_msg + 24 (mach_msg.c:323)
4   CoreFoundation                	0x00000001b459e114 __CFRunLoopServiceMachPort + 160 (CFRunLoop.c:2622)
5   CoreFoundation                	0x00000001b459f340 __CFRunLoopRun + 1208 (CFRunLoop.c:3005)
6   CoreFoundation                	0x00000001b45a44dc CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
7   CoreFoundation                	0x00000001b45e6f84 CFRunLoopRun + 64 (CFRunLoop.c:3444)
8   CoreMotion                    	0x00000001bfb126e8 CLMotionCore::runMotionThread(void*) + 1208 (CLMotionCore.mm:376)
9   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
10  libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 14 name:
Thread 14:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   JavaScriptCore                	0x00000001c7d2fafc scavenger_thread_main + 1620 (pas_scavenger.c:347)
3   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
4   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 15:
0   libsystem_kernel.dylib        	0x00000001f3232144 __semwait_signal + 8 (:-1)
1   libsystem_c.dylib             	0x00000001bba36888 nanosleep + 220 (nanosleep.c:104)
2   libsystem_c.dylib             	0x00000001bba47b1c sleep + 52 (sleep.c:62)
3   C News                   	0x000000010149822c monitorCachedData + 756
4   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
5   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 16 name:
Thread 16:
0   libsystem_kernel.dylib        	0x00000001f3231c84 mach_msg2_trap + 8 (:-1)
1   libsystem_kernel.dylib        	0x00000001f3244b54 mach_msg2_internal + 80 (mach_msg.c:201)
2   libsystem_kernel.dylib        	0x00000001f3244e2c mach_msg_overwrite + 540 (mach_msg.c:0)
3   libsystem_kernel.dylib        	0x00000001f32321c8 mach_msg + 24 (mach_msg.c:323)
4   C News                   	0x000000010149c8ac handleExceptions + 172
5   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 17:
0   libsystem_pthread.dylib       	0x0000000213eafb74 start_wqthread + 0 (:-1)

Thread 18 name:
Thread 18:
0   libsystem_kernel.dylib        	0x00000001f3232144 __semwait_signal + 8 (:-1)
1   libsystem_c.dylib             	0x00000001bba36888 nanosleep + 220 (nanosleep.c:104)
2   Foundation                    	0x00000001ae8ae94c +[NSThread sleepForTimeInterval:] + 160 (NSThread.m:499)
3   C News                   	0x0000000100b2c3a4 __24-[RealmReact setBridge:]_block_invoke + 172 (RealmReact.mm:150)
4   C News                   	0x0000000100a15f2c std::__1::__function::__value_func<void ()>::operator()() const + 20 (function.h:505)
5   C News                   	0x0000000100a15f2c std::__1::function<void ()>::operator()() const + 20 (function.h:1182)
6   C News                   	0x0000000100a15f2c facebook::react::tryAndReturnError(std::__1::function<void ()> const&) + 32 (RCTCxxUtils.mm:74)
7   C News                   	0x0000000100a0c090 -[RCTCxxBridge _tryAndHandleError:] + 100 (RCTCxxBridge.mm:344)
8   Foundation                    	0x00000001ae83789c __NSThreadPerformPerform + 264 (NSThread.m:255)
9   CoreFoundation                	0x00000001b45f8208 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 28 (CFRunLoop.c:1957)
10  CoreFoundation                	0x00000001b4604864 __CFRunLoopDoSource0 + 176 (CFRunLoop.c:2001)
11  CoreFoundation                	0x00000001b45896c8 __CFRunLoopDoSources0 + 244 (CFRunLoop.c:2038)
12  CoreFoundation                	0x00000001b459f1c4 __CFRunLoopRun + 828 (CFRunLoop.c:2953)
13  CoreFoundation                	0x00000001b45a44dc CFRunLoopRunSpecific + 612 (CFRunLoop.c:3418)
14  C News                   	0x0000000100a0bfc8 +[RCTCxxBridge runRunLoop] + 212 (RCTCxxBridge.mm:335)
15  Foundation                    	0x00000001ae857634 __NSThread__start__ + 716 (NSThread.m:963)
16  libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
17  libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 19 name:
Thread 19:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   hermes                        	0x00000001022855ac 0x102168000 + 1168812
4   hermes                        	0x0000000102285360 0x102168000 + 1168224
5   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 20 name:
Thread 20:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   C News                   	0x0000000100b08edc void std::__1::condition_variable::wait<facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1>(std::__1::unique_lock<std::__1::mutex>&, facebook::hermes::inspector::detail::SerialExec... + 28 (__mutex_base:404)
4   C News                   	0x0000000100b08edc facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41)
5   C News                   	0x0000000100acc75c decltype(static_cast<void (*>(fp)(static_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(fp0), static_cast<std::__1::function<void ()>>(fp0))) std::__1::... + 52 (type_traits:3918)
6   C News                   	0x0000000100acc75c void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1::char_traits<ch... + 56 (thread:287)
7   C News                   	0x0000000100acc75c void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1:... + 116 (thread:298)
8   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
9   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 21 name:
Thread 21:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   C News                   	0x0000000100b08edc void std::__1::condition_variable::wait<facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1>(std::__1::unique_lock<std::__1::mutex>&, facebook::hermes::inspector::detail::SerialExec... + 28 (__mutex_base:404)
4   C News                   	0x0000000100b08edc facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41)
5   C News                   	0x0000000100acc75c decltype(static_cast<void (*>(fp)(static_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(fp0), static_cast<std::__1::function<void ()>>(fp0))) std::__1::... + 52 (type_traits:3918)
6   C News                   	0x0000000100acc75c void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1::char_traits<ch... + 56 (thread:287)
7   C News                   	0x0000000100acc75c void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1:... + 116 (thread:298)
8   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
9   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 22 name:
Thread 22:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   hermes                        	0x00000001022855ac 0x102168000 + 1168812
4   hermes                        	0x0000000102285360 0x102168000 + 1168224
5   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
6   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 23 name:
Thread 23:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   C News                   	0x0000000100b08edc void std::__1::condition_variable::wait<facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1>(std::__1::unique_lock<std::__1::mutex>&, facebook::hermes::inspector::detail::SerialExec... + 28 (__mutex_base:404)
4   C News                   	0x0000000100b08edc facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41)
5   C News                   	0x0000000100acc75c decltype(static_cast<void (*>(fp)(static_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(fp0), static_cast<std::__1::function<void ()>>(fp0))) std::__1::... + 52 (type_traits:3918)
6   C News                   	0x0000000100acc75c void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1::char_traits<ch... + 56 (thread:287)
7   C News                   	0x0000000100acc75c void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1:... + 116 (thread:298)
8   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
9   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)

Thread 24 name:
Thread 24:
0   libsystem_kernel.dylib        	0x00000001f3232558 __psynch_cvwait + 8 (:-1)
1   libsystem_pthread.dylib       	0x0000000213eb7078 _pthread_cond_wait + 1232 (pthread_cond.c:636)
2   libc++.1.dylib                	0x00000001c2b40ef8 std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) + 28 (condition_variable.cpp:46)
3   C News                   	0x0000000100b08edc void std::__1::condition_variable::wait<facebook::hermes::inspector::detail::SerialExecutor::runLoop()::$_1>(std::__1::unique_lock<std::__1::mutex>&, facebook::hermes::inspector::detail::SerialExec... + 28 (__mutex_base:404)
4   C News                   	0x0000000100b08edc facebook::hermes::inspector::detail::SerialExecutor::runLoop() + 120 (SerialExecutor.cpp:41)
5   C News                   	0x0000000100acc75c decltype(static_cast<void (*>(fp)(static_cast<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >>(fp0), static_cast<std::__1::function<void ()>>(fp0))) std::__1::... + 52 (type_traits:3918)
6   C News                   	0x0000000100acc75c void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1::char_traits<ch... + 56 (thread:287)
7   C News                   	0x0000000100acc75c void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void (*)(std::__1::basic_string<char, std::__1:... + 116 (thread:298)
8   libsystem_pthread.dylib       	0x0000000213eb06b8 _pthread_start + 148 (pthread.c:893)
9   libsystem_pthread.dylib       	0x0000000213eafb88 thread_start + 8 (:-1)


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x000000016f685e18   x3: 0x000000028394d4e0
    x4: 0x0000000000000010   x5: 0x0000000000000480   x6: 0x000000000000001f   x7: 0x0000000000000001
    x8: 0x000000020acbc220   x9: 0x0000000000000103  x10: 0x0000000000000008  x11: 0x0000000000000018
   x12: 0x0000000000000007  x13: 0x0000000000000006  x14: 0x0000000000000018  x15: 0x0000000000000d59
   x16: 0x0000000301ae6dbc  x17: 0x601adb8100a5db38  x18: 0x0000000000000000  x19: 0x000000013be65010
   x20: 0x000000028394d4e0  x21: 0x00000002815e9b80  x22: 0xb85793148678d47e  x23: 0x0000000000000003
   x24: 0x000000028394d4e0  x25: 0x00000001456cca18  x26: 0x0000000000000000  x27: 0x0000000000000000
   x28: 0x00000001456cca18   fp: 0x000000016f685eb0   lr: 0x00000001009a2494
    sp: 0x000000016f685e50   pc: 0x00000001009a249c cpsr: 0x80001000
   esr: 0x92000006 (Data Abort) byte read Translation fault


Binary Images:
0x100778000 - 0x1017fbfff C News arm64  <8695789975eb3480968948a914e27be4> /private/var/containers/Bundle/Application/EAF03ADF-9EFB-4F67-B728-8CF971AF072B/C News.app/C News
0x101ec8000 - 0x101ed3fff libobjc-trampolines.dylib arm64e  <e57f2d6df3f138fea6c21fb6f6731d4c> /private/preboot/Cryptexes/OS/usr/lib/libobjc-trampolines.dylib
0x102168000 - 0x102437fff hermes arm64  <ec0cb1490c72341bb0dd5fc9c6640eec> /private/var/containers/Bundle/Application/EAF03ADF-9EFB-4F67-B728-8CF971AF072B/C News.app/Frameworks/hermes.framework/hermes
0x1ae7fc000 - 0x1af0d9fff Foundation arm64e  <35567930fbc2374bb44b1ddfe3ada4a1> /System/Library/Frameworks/Foundation.framework/Foundation
0x1b4525000 - 0x1b490cfff CoreFoundation arm64e  <6a07cbe84f653dbcb59dc1a188a7b95d> /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation
0x1b5536000 - 0x1b5900fff CFNetwork arm64e  <b2273be9538a3f56b9c7801f39550f58> /System/Library/Frameworks/CFNetwork.framework/CFNetwork
0x1b6593000 - 0x1b7db5fff UIKitCore arm64e  <b0858d8e722037bf873fecc2b0a358c3> /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore
0x1bb9ea000 - 0x1bba30fff libdispatch.dylib arm64e  <b74732b5d7fe34a4934641945701f020> /usr/lib/system/libdispatch.dylib
0x1bba31000 - 0x1bbaaeff3 libsystem_c.dylib arm64e  <72233fdeddfe3e78b9912dece8cd78c5> /usr/lib/system/libsystem_c.dylib
0x1bfaff000 - 0x1bff0afff CoreMotion arm64e  <0ee3bd53a7dd3267999d2e31676c9c5b> /System/Library/Frameworks/CoreMotion.framework/CoreMotion
0x1c2b2e000 - 0x1c2bbaff7 libc++.1.dylib arm64e  <db5662ce22e032e09f152fd7c1cbfe43> /usr/lib/libc++.1.dylib
0x1c7c1c000 - 0x1c9338fff JavaScriptCore arm64e  <b98c048075373f8883d7308dba0c9005> /System/Library/Frameworks/JavaScriptCore.framework/JavaScriptCore
0x1d3a17000 - 0x1d3a9c923 dyld arm64e  <41605dc7f41237d1b51bfee1a26701e9> /usr/lib/dyld
0x1ef803000 - 0x1ef80bfff GraphicsServices arm64e  <b7999f4384c030f99096cceb457fbe4a> /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices
0x1f3231000 - 0x1f3268ff7 libsystem_kernel.dylib arm64e  <5998c9aec77e3681bd6c0883c89297cf> /usr/lib/system/libsystem_kernel.dylib
0x213eaf000 - 0x213ebaff3 libsystem_pthread.dylib arm64e  <b1ee57e144843714ba1a104330ca10c6> /usr/lib/system/libsystem_pthread.dylib

EOF

I got the same issue and i’ using version 3.0.2 as well. Did you find a solution?

@j-piasecki Thanks for this. Yes, here is an issue I created a few weeks ago: #4268 My codebase uses Reanimated v2 heavily in one screen (with 100+ shared values, dozens of components with animated styles, etc). It works great in v2 (with a few hacks), but upgrading to v3 totally breaks it - I’ve tried to upgrade a few times. I’ll continue the conversation there.

Could you share what hacks do you mean please? I have to use reanimated1 when I need a lot of animated objects.

Interesting - I’m actually successful doing everything I need in reanimated 2. The hacks are that sometimes adding a console.log to a worklet fixes lagginess in the UI. It’s pretty rare, but sometimes adding the console.log works.

@coayscue If you have any issues with Reanimated v3, would you mind posting them here so we could tackle them?

As for the solution, I, unfortunately, think that upgrading to Reanimated v3 is the best one. The root cause of this problem lies deeper in the core of Reanimated v2, which has been rewritten from scratch in v3, with the goal of fixing the issues like this one.

unfortunately yes. Looks like it’s related with shared pointers architecture and it’s fixed in v3