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
andI18nManager.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)
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
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.
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.Yes, fixed in V3!
I can confirm that it’s fixed in v3 (in my case)
I got the same issue and i’ using version
3.0.2
as well. Did you find a solution?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.
Might related with this. https://github.com/software-mansion/react-native-reanimated/issues/1912#issuecomment-1449278418 It happens both in Android + iOS.
unfortunately yes. Looks like it’s related with shared pointers architecture and it’s fixed in v3