Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[go] fix ios expo go crash from exceptions #24305

Merged
merged 2 commits into from Sep 6, 2023
Merged

Conversation

Kudo
Copy link
Contributor

@Kudo Kudo commented Sep 6, 2023

Why

potentially to fix the strange ios crash after login

How

  • the root cause is that we didn't implement correct RCTExceptionsManagerDelegate protocol from react-native upgrade. that would probably cause the error stacktrace:
    Last Exception Backtrace:
    0   CoreFoundation                      0x1c938ce38 __exceptionPreprocess + 164 (NSException.m:202)
    1   libobjc.A.dylib                     0x1c25238d8 objc_exception_throw + 60 (objc-exception.mm:356)
    2   CoreFoundation                      0x1c950181c -[NSObject(NSObject) doesNotRecognizeSelector:] + 136 (NSObject.m:140)
    3   CoreFoundation                      0x1c93a2ce8 ___forwarding___ + 976 (NSForwarding.m:3620)
    4   CoreFoundation                      0x1c940b320 _CF_forwarding_prep_0 + 96 (:-1)
    5   Expo Go                             0x105588678 -[RCTExceptionsManager reportSoft:stack:exceptionId:extraDataAsJSON:] + 244 (RCTExceptionsManager.mm:50)
    6   Expo Go                             0x105589010 -[RCTExceptionsManager reportException:] + 1320 (RCTExceptionsManager.mm:156)
    7   CoreFoundation                      0x1c93f76b4 __invoking___ + 148 (:-1)
    8   CoreFoundation                      0x1c93a3b1c -[NSInvocation invoke] + 428 (NSForwarding.m:3377)
    9   CoreFoundation                      0x1c93a3534 -[NSInvocation invokeWithTarget:] + 64 (NSForwarding.m:3474)
    10  Expo Go                             0x105542a60 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 388 (RCTModuleMethod.mm:584)
    11  Expo Go                             0x105544ac0 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 456 (RCTNativeModule.mm:197)
    12  Expo Go                             0x105544710 facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const + 68 (RCTNativeModule.mm:114)
    13  Expo Go                             0x105544710 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 112 (RCTNativeModule.mm:105)
    14  libdispatch.dylib                   0x1d09a3460 _dispatch_call_block_and_release + 32 (init.c:1518)
    15  libdispatch.dylib                   0x1d09a4f88 _dispatch_client_callout + 20 (object.m:560)
    16  libdispatch.dylib                   0x1d09ac640 _dispatch_lane_serial_drain + 672 (inline_internal.h:2632)
    17  libdispatch.dylib                   0x1d09ad18c _dispatch_lane_invoke + 384 (queue.c:3940)
    18  libdispatch.dylib                   0x1d09b7e10 _dispatch_workloop_worker_thread + 652 (queue.c:6876)
    19  libsystem_pthread.dylib             0x217604df8 _pthread_wqthread + 288 (pthread.c:2618)
    20  libsystem_pthread.dylib             0x217604b98 start_wqthread + 8 (:-1)
    
  • add -Werror=protocol to have compiler error if we don't implement correct protocol in the future.

Test Plan

expo go release build + local build production home with some console.error()

Checklist

@expo-bot expo-bot added the bot: passed checks ExpoBot has nothing to complain about label Sep 6, 2023
@Kudo Kudo marked this pull request as ready for review September 6, 2023 13:08
@Kudo Kudo requested a review from tsapeta September 6, 2023 13:16
@Kudo Kudo merged commit 529650a into main Sep 6, 2023
4 checks passed
@Kudo Kudo deleted the @kudo/fix-ios-expo-go-crash branch September 6, 2023 13:35
Kudo added a commit that referenced this pull request Sep 8, 2023
# Why

potentially to fix the strange ios crash after login

# How

- the root cause is that we didn't implement correct `RCTExceptionsManagerDelegate` protocol from react-native upgrade. that would probably cause the error stacktrace:
  ```
  Last Exception Backtrace:
  0   CoreFoundation                      0x1c938ce38 __exceptionPreprocess + 164 (NSException.m:202)
  1   libobjc.A.dylib                     0x1c25238d8 objc_exception_throw + 60 (objc-exception.mm:356)
  2   CoreFoundation                      0x1c950181c -[NSObject(NSObject) doesNotRecognizeSelector:] + 136 (NSObject.m:140)
  3   CoreFoundation                      0x1c93a2ce8 ___forwarding___ + 976 (NSForwarding.m:3620)
  4   CoreFoundation                      0x1c940b320 _CF_forwarding_prep_0 + 96 (:-1)
  5   Expo Go                             0x105588678 -[RCTExceptionsManager reportSoft:stack:exceptionId:extraDataAsJSON:] + 244 (RCTExceptionsManager.mm:50)
  6   Expo Go                             0x105589010 -[RCTExceptionsManager reportException:] + 1320 (RCTExceptionsManager.mm:156)
  7   CoreFoundation                      0x1c93f76b4 __invoking___ + 148 (:-1)
  8   CoreFoundation                      0x1c93a3b1c -[NSInvocation invoke] + 428 (NSForwarding.m:3377)
  9   CoreFoundation                      0x1c93a3534 -[NSInvocation invokeWithTarget:] + 64 (NSForwarding.m:3474)
  10  Expo Go                             0x105542a60 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 388 (RCTModuleMethod.mm:584)
  11  Expo Go                             0x105544ac0 facebook::react::invokeInner(RCTBridge*, RCTModuleData*, unsigned int, folly::dynamic const&, int, (anonymous namespace)::SchedulingContext) + 456 (RCTNativeModule.mm:197)
  12  Expo Go                             0x105544710 facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int)::$_0::operator()() const + 68 (RCTNativeModule.mm:114)
  13  Expo Go                             0x105544710 invocation function for block in facebook::react::RCTNativeModule::invoke(unsigned int, folly::dynamic&&, int) + 112 (RCTNativeModule.mm:105)
  14  libdispatch.dylib                   0x1d09a3460 _dispatch_call_block_and_release + 32 (init.c:1518)
  15  libdispatch.dylib                   0x1d09a4f88 _dispatch_client_callout + 20 (object.m:560)
  16  libdispatch.dylib                   0x1d09ac640 _dispatch_lane_serial_drain + 672 (inline_internal.h:2632)
  17  libdispatch.dylib                   0x1d09ad18c _dispatch_lane_invoke + 384 (queue.c:3940)
  18  libdispatch.dylib                   0x1d09b7e10 _dispatch_workloop_worker_thread + 652 (queue.c:6876)
  19  libsystem_pthread.dylib             0x217604df8 _pthread_wqthread + 288 (pthread.c:2618)
  20  libsystem_pthread.dylib             0x217604b98 start_wqthread + 8 (:-1)
  ```
- add `-Werror=protocol` to have compiler error if we don't implement correct protocol in the future.

# Test Plan

expo go release build + local build production home with some `console.error()`

(cherry picked from commit 529650a)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot: passed checks ExpoBot has nothing to complain about
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants