question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ios] useAnimatedKeyboard causes crash when reloading app

See original GitHub issue

Description

When using the useAnimatedKeyboard hook on iOS, attempting to reload the app causes a crash.

I’ve observed this with:

  • react-native-reanimated 2.10.0, 2.11.0 and 2.12.0

  • expo 46 and 47

  • react-native 0.69 and 0.70

  • in both debug and release schemes (on release, via expo’s Updates.reloadAsync())

  • on both the iOS simulator and a real device

  • Using JSC, the crash happens immediately.

  • Using hermes, sometimes the crash doesn’t happen until you focus a text input (presenting the keyboard) after reloading the app.

I created two snacks to demonstrate the crash:

Steps to reproduce

  1. Add useAnimatedKeyboard() to any component that’s rendered in your app.
  2. Reload the app.
  3. Observe the app crash.

Snack or a link to a repository

https://snack.expo.dev/@danscan/fa5482

Reanimated version

2.12.0

React Native version

0.70.5

Platforms

iOS

JavaScript runtime

JSC

Workflow

Expo managed workflow

Architecture

Paper (Old Architecture)

Build type

Debug mode

Device

iOS simulator

Device model

No response

Acknowledgements

Yes

Issue Analytics

  • State:open
  • Created 10 months ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
justinkxcommented, Dec 2, 2022

Got similar crash in iOS when tried to reload using expo Updates.reloadAsync()

EXC_BAD_ACCESS RCTModalHostViewController
Exception Type: EXC_BAD_ACCESS (SIGBUS)
Exception Codes: BUS_NOOP
Crashed Thread: 2
Application Specific Information:
ttcf > XTUM >
Attempted to dereference null pointer.
Thread 2 name: com.facebook.react.JavaScript Crashed:
0                     0x20272605c         [inlined] facebook::jsi::Pointer::~Pointer (jsi.h:371)
1                     0x20272605c         [inlined] facebook::jsi::Object::~Object (jsi.h:562)
2                     0x20272605c         [inlined] facebook::jsi::Function::~Function (jsi.h:854)
3                     0x20272605c         [inlined] facebook::jsi::Function::~Function (jsi.h:854)
4                     0x20272605c         std::__1::__shared_ptr_emplace<T>::__on_zero_shared (shared_ptr.h:315)
5                     0x202698514         [inlined] std::__1::__shared_count::__release_shared (shared_ptr.h:177)
6                      0x202698514         [inlined] std::__1::__shared_weak_count::__release_shared (shared_ptr.h:219)
7                      0x202698514         std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:959)
8                      0x20282b1d8         [inlined] std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:957)
9                      0x20282b1d8         [inlined] reanimated::HostFunctionHandler::~HostFunctionHandler (HostFunctionHandler.h:11)
10                     0x20282b1d8         reanimated::HostFunctionHandler::~HostFunctionHandler (HostFunctionHandler.h:11)
11                     0x202698514         [inlined] std::__1::__shared_count::__release_shared (shared_ptr.h:177)
12                     0x202698514         [inlined] std::__1::__shared_weak_count::__release_shared (shared_ptr.h:219)
13                     0x202698514         std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:959)
14                     0x20282bd3c         [inlined] std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:957)
15                     0x20282bd3c         [inlined] reanimated::ShareableValue::toJSValue::lambda::~lambda (ShareableValue.cpp:326)
16                     0x20282bd3c         [inlined] reanimated::ShareableValue::toJSValue::lambda::~lambda (ShareableValue.cpp:326)
17                     0x20282bd3c         [inlined] std::__1::__compressed_pair_elem<T>::~__compressed_pair_elem (compressed_pair.h:35)
18                     0x20282bd3c         [inlined] std::__1::__compressed_pair<T>::~__compressed_pair (compressed_pair.h:109)
19                     0x20282bd3c         [inlined] std::__1::__compressed_pair<T>::~__compressed_pair (compressed_pair.h:109)
20                     0x20282bd3c         [inlined] std::__1::__function::__alloc_func<T>::destroy (function.h:197)
21                     0x20282bd3c         std::__1::__function::__func<T>::destroy_deallocate (function.h:344)
22                     0x202963c10         [inlined] std::__1::__function::__value_func<T>::~__value_func
23                     0x202963c10         [inlined] std::__1::__function::__value_func<T>::~__value_func (function.h:462)
24                     0x202963c10         [inlined] std::__1::function<T>::~function (function.h:1169)
25                     0x202963c10         [inlined] std::__1::function<T>::~function (function.h:1169)
26                     0x202963c10         [inlined] facebook::jsi::DecoratedHostFunction::~DecoratedHostFunction (decorator.h:25)
27                     0x202963c10         [inlined] facebook::jsi::DecoratedHostFunction::~DecoratedHostFunction (decorator.h:25)
28                     0x202963c10         [inlined] std::__1::__compressed_pair_elem<T>::~__compressed_pair_elem (compressed_pair.h:35)
29                     0x202963c10         [inlined] std::__1::__compressed_pair<T>::~__compressed_pair (compressed_pair.h:109)
30                     0x202963c10         [inlined] std::__1::__compressed_pair<T>::~__compressed_pair (compressed_pair.h:109)
31                     0x202963c10         [inlined] std::__1::__function::__alloc_func<T>::destroy (function.h:197)
32                     0x202963c10         std::__1::__function::__func<T>::destroy_deallocate (function.h:344)
33  hermes                          0x103b24994         facebook::hermes::debugger::Debugger::jsiValueFromHermesValue
34  hermes                          0x103c28768         facebook::jsi::JSError::~JSError
35  hermes                          0x103b9a2dc         facebook::jsi::JSError::~JSError
36  hermes                          0x103b9a824         facebook::jsi::JSError::~JSError
37  hermes                          0x103b1fdbc         facebook::hermes::debugger::Debugger::jsiValueFromHermesValue
38  hermes                          0x103b1dcd4         facebook::hermes::debugger::Debugger::jsiValueFromHermesValue
39                     0x202698514         [inlined] std::__1::__shared_count::__release_shared (shared_ptr.h:177)
40                     0x202698514         [inlined] std::__1::__shared_weak_count::__release_shared (shared_ptr.h:219)
41                     0x202698514         std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:959)
42                     0x20296157c         [inlined] std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:957)
43                     0x20296157c         [inlined] facebook::react::(anonymous namespace)::DecoratedRuntime::~DecoratedRuntime (HermesExecutorFactory.cpp:183)
44                     0x20296157c         facebook::react::(anonymous namespace)::DecoratedRuntime::~DecoratedRuntime (HermesExecutorFactory.cpp:177)
45                     0x202698514         [inlined] std::__1::__shared_count::__release_shared (shared_ptr.h:177)
46                     0x202698514         [inlined] std::__1::__shared_weak_count::__release_shared (shared_ptr.h:219)
47                     0x202698514         std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:959)
48                     0x202960d84         [inlined] std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:957)
49                     0x202960d84         facebook::react::JSIExecutor::~JSIExecutor (JSIExecutor.h:71)
50                     0x202960f88         [inlined] facebook::react::HermesExecutor::~HermesExecutor (HermesExecutorFactory.h:49)
51                     0x202960f88         [inlined] facebook::react::HermesExecutor::~HermesExecutor (HermesExecutorFactory.h:49)
52                     0x202960f88         facebook::react::HermesExecutor::~HermesExecutor (HermesExecutorFactory.h:49)
53                     0x2028922b4         [inlined] std::__1::__function::__value_func<T>::operator() (function.h:505)
54                     0x2028922b4         [inlined] std::__1::function<T>::operator() (function.h:1182)
55                     0x2028922b4         facebook::react::tryAndReturnError (RCTCxxUtils.mm:74)
56                     0x20289d330         facebook::react::RCTMessageThread::tryFunc (RCTMessageThread.mm:69)
57                     0x20289d674         facebook::react::RCTMessageThread::runOnQueueSync (RCTMessageThread.mm:92)
58                     0x2029361d4         facebook::react::NativeToJsBridge::destroy (NativeToJsBridge.cpp:285)
59                     0x20292ca10         facebook::react::Instance::~Instance (Instance.cpp:38)
60                     0x20288faa0         [inlined] std::__1::default_delete<T>::operator() (unique_ptr.h:57)
61                     0x20288faa0         std::__1::__shared_ptr_pointer<T>::__on_zero_shared (shared_ptr.h:267)
62                     0x20288cdb4         [inlined] std::__1::__shared_count::__release_shared (shared_ptr.h:177)
63                     0x20288cdb4         [inlined] std::__1::__shared_weak_count::__release_shared (shared_ptr.h:219)
64                     0x20288cdb4         [inlined] std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:959)
65                     0x20288cdb4         [inlined] std::__1::shared_ptr<T>::~shared_ptr (shared_ptr.h:957)
66                     0x20288cdb4         [inlined] std::__1::shared_ptr<T>::reset (shared_ptr.h:1054)
67                     0x20288cdb4         __26-[RCTCxxBridge invalidate]_block_invoke (RCTCxxBridge.mm:1302)
68                     0x2028922b4         [inlined] std::__1::__function::__value_func<T>::operator() (function.h:505)
69                     0x2028922b4         [inlined] std::__1::function<T>::operator() (function.h:1182)
70                     0x2028922b4         facebook::react::tryAndReturnError (RCTCxxUtils.mm:74)
71                     0x202888574         -[RCTCxxBridge _tryAndHandleError:] (RCTCxxBridge.mm:344)
72  Foundation                      0x341d1faac         __NSThreadPerformPerform
73  CoreFoundation                  0x34d5f9f50         __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
74  CoreFoundation                  0x34d606328         __CFRunLoopDoSource0
75  CoreFoundation                  0x34d58a20c         __CFRunLoopDoSources0
76  CoreFoundation                  0x34d59fba4         __CFRunLoopRun
77  CoreFoundation                  0x34d5a4ed0         CFRunLoopRunSpecific
78                     0x2028884ac         +[RCTCxxBridge runRunLoop] (RCTCxxBridge.mm:335)
79  Foundation                      0x341d3f804         __NSThread__start__
80  libsystem_pthread.dylib         0x3e75e36c8         _pthread_start
1reaction
danscancommented, Nov 21, 2022

@Norfeldt I think this may be different, and not just an xcode version issue. I’m encountering it in debug mode on xcode 14.0.1, as well as in the Expo Snack I provided for repro. This also occurs in release builds and on real iPhones when reloading the app (e.g. via expo’s Updates.reloadAsync())

Read more comments on GitHub >

github_iconTop Results From Across the Web

SwiftUI List reload causes crash | Apple Developer Forums
I get a crash when reloading a List based on some search results. The results may change out the sections and rows. The...
Read more >
App crash when reload button is pressed - ios - Stack Overflow
Im using storyboard. Simply pressing alt and drag the button to my ViewController.swift and create the action IBAction. Where should i put this ......
Read more >
Common Flutter errors
Introduction. This page explains several frequently-encountered Flutter framework errors and gives suggestions on how to resolve them.
Read more >
Basic troubleshooting steps to fix most issues - Adobe Support
Many problems can occur when you use third-party fonts, including crashing or hangs when selecting the Type tool or when making the Character ......
Read more >
Manually reloading your Flutter web app causes it to crash/get ...
For those of you working on a Flutter web app, when you manually reload the browser using its native reload button, does your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found