Skip to content

Fatal Exception in RCTCxxBridge.mm after migrating to New Architecture #47089

@janakivnair

Description

@janakivnair

Description

  • A non-std C++ exception is reported by Crashlytics for 5% of the users after migrating the app to new Architecture. Please note that it is not reproducible on debug builds and happens rarely in lower environments.
  • The issue occurs on load of the app and repeats for the same user on the app downloaded from appstore
  • The issue is reported only on iOS builds

Steps to reproduce

  • Note that the issue is not commonly reproducible and gets reported by Crashlytics for around 5% of the total users.
  • Would help if we could get any pointers towards fixing the issue as this is bringing our Crash-free % down.

React Native Version

0.73.10

Affected Platforms

Runtime - iOS

Areas

Bridgeless - The New Initialization Flow

Output of npx react-native info

System:
  OS: macOS 14.5
  CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Memory: 788.16 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.12.2
    path: ~/.nvm/versions/node/v20.12.2/bin/node
  Yarn:
    version: 1.22.22
    path: ~/.nvm/versions/node/v20.12.2/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.nvm/versions/node/v20.12.2/bin/npm
  Watchman:
    version: 2024.04.01.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /Users/janaki_nair/.rbenv/shims/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "30"
      - "31"
      - "32"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.2
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
    System Images:
      - android-33 | Intel x86_64 Atom
      - android-33 | Google APIs ARM 64 v8a
      - android-33 | Google APIs Intel x86_64 Atom
      - android-33 | Google Play Intel x86_64 Atom
      - android-34 | Google APIs Intel x86_64 Atom
      - android-34 | Google Play Intel x86_64 Atom
      - android-UpsideDownCakePrivacySandbox | Google Play Intel x86_64 Atom
    Android NDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10406996
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.10
    path: /usr/local/opt/openjdk@17/bin/javac
  Ruby:
    version: 2.7.6
    path: /Users/janaki_nair/.rbenv/shims/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.73.9
    wanted: 0.73.9
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

# Crashlytics - Stack trace
# Application: com.tractorsupply.CMA
# Platform: apple
# Version: 1.46.3 (192)
# Issue: 8e01f2f4aebf12a4aadb4c677526d884
# Session: e0c7970084084dd98a138a4286fb259f_DNE_0_v2
# Date: Thu Oct 17 2024 06:49:32 GMT-0400 (Eastern Daylight Time)

Fatal Exception: RCTFatalException: non-std C++ exception
0  CoreFoundation                 0x9e88 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  TSC                            0x6b2f88 RCTFormatError + 167 (RCTAssert.m:167)
3  TSC                            0x6ca740 -[RCTCxxBridge handleError:] + 1123 (RCTCxxBridge.mm:1123)
4  TSC                            0x6c90a0 __34-[RCTCxxBridge _initializeBridge:]_block_invoke + 668 (RCTCxxBridge.mm:668)
5  TSC                            0x6dd080 facebook::react::RCTMessageThread::tryFunc(std::__1::function<void ()> const&) + 72 (RCTMessageThread.mm:72)
6  TSC                            0x6dce2c invocation function for block in facebook::react::RCTMessageThread::runAsync(std::__1::function<void ()>) + 45 (RCTMessageThread.mm:45)
7  CoreFoundation                 0x43564 __CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__
8  CoreFoundation                 0xabd9c __CFRunLoopDoBlocks
9  CoreFoundation                 0x7bb98 __CFRunLoopRun
10 CoreFoundation                 0x80ed4 CFRunLoopRunSpecific
11 TSC                            0x6c6e30 +[RCTCxxBridge runRunLoop] + 332 (RCTCxxBridge.mm:332)
12 Foundation                     0x5b808 __NSThread__start__
13 libsystem_pthread.dylib        0x16cc _pthread_start
14 libsystem_pthread.dylib        0xba4 thread_start

com.apple.main-thread
0  UIKitCore                      0x327048 -[UIViewController _presentViewController:withAnimationController:completion:] + 1952
1  UIKitCore                      0x39d4e4 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke_2 + 56
2  UIKitCore                      0x31564 +[UIView(Animation) performWithoutAnimation:] + 76
3  UIKitCore                      0x326860 __63-[UIViewController _presentViewController:animated:completion:]_block_invoke + 208
4  UIKitCore                      0x304984 -[UIViewController _performCoordinatedPresentOrDismiss:animated:] + 396
5  UIKitCore                      0xd2af0 -[UIViewController _presentViewController:animated:completion:] + 188
6  UIKitCore                      0xd292c -[UIViewController presentViewController:animated:completion:] + 164
7  TSC                            0x52d0e0 +[RNBootSplash onJavaScriptDidLoad:] + 57 (RNBootSplash.m:57)
8  CoreFoundation                 0x37404 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148
9  CoreFoundation                 0xde474 ___CFXRegistrationPost_block_invoke + 88
10 CoreFoundation                 0xc1724 _CFXRegistrationPost + 440
11 CoreFoundation                 0x4ba08 _CFXNotificationPost + 704
12 Foundation                     0x5cffc -[NSNotificationCenter postNotificationName:object:userInfo:] + 92
13 TSC                            0x6ca474 __53-[RCTCxxBridge executeSourceCode:withSourceURL:sync:]_block_invoke_2 + 1041 (RCTCxxBridge.mm:1041)
14 libdispatch.dylib              0x24b4 _dispatch_call_block_and_release + 32
15 libdispatch.dylib              0x3fdc _dispatch_client_callout + 20
16 libdispatch.dylib              0x127f4 _dispatch_main_queue_drain + 928
17 libdispatch.dylib              0x12444 _dispatch_main_queue_callback_4CF + 44
18 CoreFoundation                 0x9a6f8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 16
19 CoreFoundation                 0x7c058 __CFRunLoopRun + 2036
20 CoreFoundation                 0x80ed4 CFRunLoopRunSpecific + 612
21 GraphicsServices               0x1368 GSEventRunModal + 164
22 UIKitCore                      0x3a23d0 -[UIApplication _run] + 888
23 UIKitCore                      0x3a2034 UIApplicationMain + 340
24 TSC                            0xb210 main + 18 (main.m:18)
25 ???                            0x1d2f88960 (Missing)

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

Thread
0  libsystem_kernel.dylib         0x1050 __workq_kernreturn + 8
1  libsystem_pthread.dylib        0xe44 _pthread_wqthread + 364
2  libsystem_pthread.dylib        0xb98 start_wqthread + 8

DTX_COMM_THREAD_8.277.1.1004
0  libsystem_kernel.dylib         0x1008 __semwait_signal + 8
1  libsystem_c.dylib              0x57d8 nanosleep + 220
2  Foundation                     0xb2b60 +[NSThread sleepForTimeInterval:] + 160
3  Dynatrace                      0x490c8 -[DTXCommunicationsManager(Private) run] + 3568
4  Foundation                     0x5b808 __NSThread__start__ + 716
5  libsystem_pthread.dylib        0x16cc _pthread_start + 148
6  libsystem_pthread.dylib        0xba4 thread_start + 8

DTX_DB_THREAD_8.277.1.1004
0  libsystem_kernel.dylib         0x1008 __semwait_signal + 8
1  libsystem_c.dylib              0x57d8 nanosleep + 220
2  Foundation                     0xb2b60 +[NSThread sleepForTimeInterval:] + 160
3  Dynatrace                      0xb9000 -[DTXDBManager(Private) run] + 1040
4  Foundation                     0x5b808 __NSThread__start__ + 716
5  libsystem_pthread.dylib        0x16cc _pthread_start + 148
6  libsystem_pthread.dylib        0xba4 thread_start + 8

DTX_AUA_THREAD_8.277.1.1004
0  libsystem_kernel.dylib         0x1008 __semwait_signal + 8
1  libsystem_c.dylib              0x57d8 nanosleep + 220
2  Foundation                     0xb2b60 +[NSThread sleepForTimeInterval:] + 160
3  Dynatrace                      0x6f624 -[DTXInternalActionManager autoUserActionThread:] + 148
4  Foundation                     0x5b808 __NSThread__start__ + 716
5  libsystem_pthread.dylib        0x16cc _pthread_start + 148
6  libsystem_pthread.dylib        0xba4 thread_start + 8

DTX_KSK_THREAD
0  libsystem_kernel.dylib         0x1008 __semwait_signal + 8
1  libsystem_c.dylib              0x57d8 nanosleep + 220
2  libsystem_c.dylib              0x19ad8 sleep + 52
3  Dynatrace                      0xe3fe0 monitorCachedData + 764
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

KSCrash Exception Handler (Secondary)
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0xd1a0 thread_suspend + 112
3  Dynatrace                      0xeab98 handleExceptions + 164
4  libsystem_pthread.dylib        0x16cc _pthread_start + 148
5  libsystem_pthread.dylib        0xba4 thread_start + 8

KSCrash Exception Handler (Primary)
0  libsystem_kernel.dylib         0xb48 mach_msg2_trap + 8
1  libsystem_kernel.dylib         0x13008 mach_msg2_internal + 80
2  libsystem_kernel.dylib         0x13248 mach_msg_overwrite + 388
3  libsystem_kernel.dylib         0x108c mach_msg + 24
4  Dynatrace                      0xeac0c handleExceptions + 280
5  libsystem_pthread.dylib        0x16cc _pthread_start + 148
6  libsystem_pthread.dylib        0xba4 thread_start + 8

Reproducer

No reproducer since this is reported by Crashlytics for a percentage of users

Screenshots and Videos

Find attached package.json and complete stack trace of the crash
package.json
com.tractorsupply.CMA_issue_stacktrace.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: AttentionIssues where the author has responded to feedback.Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.Newer Patch AvailableStaleThere has been a lack of activity on this issue and it may be closed soon.Type: New ArchitectureIssues and PRs related to new architecture (Fabric/Turbo Modules)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions