react-native: iOS crash - RCTCxxBridge enqueueApplicationScript:url:onComplete

Description

we are experiencing this crash after upgrading react-native version from 0.66.5 to 0.71.13

Crashed: com.apple.root.user-interactive-qos EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000

  • RCTCxxBridge.mm - Line 1492
  • RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 1492
  • RCTCxxBridge.mm - Line 1088
  • RCTCxxBridge executeSourceCode:withSourceURL:sync:] + 1088
  • RCTCxxBridge.mm - Line 512

__21-[RCTCxxBridge start]_block_invoke_2 + 512We

Steps to reproduce

unable to reproduce @debug mode, only occurs in Firebase crash logs.

React Native Version

0.71.13 (false)

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
    OS: macOS 14.1.1
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
    Memory: 40.98 MB / 16.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 18.17.0 - ~/.nvm/versions/node/v18.17.0/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.0/bin/npm
    Watchman: 2023.06.12.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/macbookpro/.rvm/rubies/ruby-2.7.5/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2022.2 AI-222.4459.24.2221.9862592
    Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.19 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.13 => 0.71.13 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Stacktrace or Logs

-[RCTCxxBridge enqueueApplicationScript:url:onComplete:]
EXC_BAD_ACCESS (KERN_INVALID_ADDRESS)

Crashed: com.apple.root.user-interactive-qos
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000

Crashed: com.apple.root.user-interactive-qos
0                            0x303d0c -[RCTCxxBridge enqueueApplicationScript:url:onComplete:] + 1492 (RCTCxxBridge.mm:1492)
1                           0x301bf0 -[RCTCxxBridge executeSourceCode:withSourceURL:sync:] + 1088 (RCTCxxBridge.mm:1088)
2                          0x2ff8d0 __21-[RCTCxxBridge start]_block_invoke_2 + 512 (RCTCxxBridge.mm:512)
3  libdispatch.dylib              0x2320 _dispatch_call_block_and_release + 32
4  libdispatch.dylib              0x3eac _dispatch_client_callout + 20
5  libdispatch.dylib              0x15a64 _dispatch_root_queue_drain + 684
6  libdispatch.dylib              0x16158 _dispatch_worker_thread2 + 164
7  libsystem_pthread.dylib        0xda0 _pthread_wqthread + 228
8  libsystem_pthread.dylib        0xb7c start_wqthread + 8

Reproducer

I can not find any pattern to get to the crash issue.

This is the stacktrace I got from firebase.

Crashlytics - Stack trace Platform: apple Version: 10.0.0 (1) Issue: 79e765fc6589aab56495ab1ac2b10d63 Session: ffed3e5f7ab449729098a9cb06b42316_DNE_0_v2

com.heartbeat.storage.1:952492006042:ios:f96f3a5be793b8f2ec1d23 0 Foundation 0x3d208c specialized Data.init(referencing:) + 842 1 0xf9314 HeartbeatStorage.load(from:) + 142 (HeartbeatStorage.swift:142) 2 0xf921c closure #1 in HeartbeatStorage.readAndWriteSync(using:) + 99 (HeartbeatStorage.swift:99) 3 0xf0e30 partial apply for thunk for @callee_guaranteed () -> () + 4309257776 (<compiler-generated>:4309257776) 4 0xf03c8 thunk for @escaping @callee_guaranteed () -> () + 4309255112 (<compiler-generated>:4309255112) 5 libdispatch.dylib 0x3eac _dispatch_client_callout + 20 6 libdispatch.dylib 0x13428 _dispatch_lane_barrier_sync_invoke_and_complete + 56 7 0xef1a8 HeartbeatController.flushHeartbeatFromToday() + 98 (HeartbeatStorage.swift:98) 8 0xed168 @objc _ObjC_HeartbeatController.flush() + 4309242216 9 0xeb224 -[FIRHeartbeatLogger heartbeatCodeForToday] + 81 (FIRHeartbeatLogger.m:81) 10 0x14ad5c -[FIRMessagingTokenFetchOperation performTokenOperation] + 61 (FIRMessagingTokenFetchOperation.m:61) 11 0x14fd34 __35-[FIRMessagingTokenOperation start]_block_invoke + 131 (FIRMessagingTokenOperation.m:131) 12 0x12ed14 __55-[FIRInstallations authTokenForcingRefresh:completion:]_block_invoke_2 + 225 (FIRInstallations.m:225) 13 0x1e9b58 __56-[FBLPromise chainOnQueue:chainedFulfill:chainedReject:]_block_invoke.18 + 273 (FBLPromise.m:273) 14 libdispatch.dylib 0x2320 _dispatch_call_block_and_release + 32 15 libdispatch.dylib 0x3eac _dispatch_client_callout + 20 16 libdispatch.dylib 0x12700 _dispatch_main_queue_drain + 1020 17 libdispatch.dylib 0x122f4 _dispatch_main_queue_callback_4CF + 44 18 CoreFoundation 0x98c28 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 19 CoreFoundation 0x7a560 __CFRunLoopRun + 1992 20 CoreFoundation 0x7f3ec CFRunLoopRunSpecific + 612 21 GraphicsServices 0x135c GSEventRunModal + 164 22 UIKitCore 0x39cf58 -[UIApplication _run] + 888 23 UIKitCore 0x39cbbc UIApplicationMain + 340 24 0xb460 main + 7 (main.m:7) 25 ??? 0x1b8eb4dec (Missing)

Thread 0 libsystem_kernel.dylib 0x11ac __workq_kernreturn + 8 1 libsystem_pthread.dylib 0xe28 _pthread_wqthread + 364 2 libsystem_pthread.dylib 0xb7c start_wqthread + 8

Thread 0 libsystem_pthread.dylib 0xb74 start_wqthread + 254

Screenshots and Videos

photo_2024-01-10_13-21-48

About this issue

  • Original URL
  • State: open
  • Created 6 months ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

We get this crash after upgrading react-native version from 0.65.3 to 0.72.9. There are quite a lot of errors. Maybe you have any idea?

It is interesting that this error can get several times for a user.

1 1 1
{
  "code": "0x1",
  "exception_name": "EXC_BAD_ACCESS",
  "subcode": "0x0",
  "exception": 1,
  "code_name": "KERN_INVALID_ADDRESS"
}
  "dependencies": {
    "@bugsnag/react-native": "7.22.3",
    "@react-native-async-storage/async-storage": "1.21.0",
    "@react-native-camera-roll/camera-roll": "7.4.0",
    "@react-native-clipboard/clipboard": "1.11.1",
    "@react-native-cookies/cookies": "6.2.1",
    "@react-native-firebase/analytics": "18.9.0",
    "@react-native-firebase/app": "18.9.0",
    "@react-native-firebase/functions": "18.9.0",
    "@react-native-firebase/messaging": "18.9.0",
    "@react-native-firebase/perf": "18.9.0",
    "@react-native-firebase/remote-config": "18.9.0",
    "@react-navigation/bottom-tabs": "6.5.11",
    "@react-navigation/native": "6.1.9",
    "@react-navigation/native-stack": "6.9.17",
    "axios": "1.6.7",
    "i18n-js": "4.3.2",
    "jwt-decode": "3.1.2",
    "moment": "2.30.1",
    "prop-types": "15.8.1",
    "qs": "6.11.2",
    "react": "18.2.0",
    "react-native": "0.72.9",
    "react-native-code-push": "8.1.1",
    "react-native-date-picker": "4.3.5",
    "react-native-devsettings": "1.0.5",
    "react-native-gesture-handler": "2.14.1",
    "react-native-image-crop-picker": "0.40.2",
    "react-native-image-resizer": "1.4.5",
    "react-native-linear-gradient": "2.8.3",
    "react-native-onesignal": "5.0.6",
    "react-native-pager-view": "6.2.3",
    "react-native-permissions": "4.1.1",
    "react-native-rate": "1.2.12",
    "react-native-reanimated": "3.6.1",
    "react-native-render-html": "6.3.4",
    "react-native-safe-area-context": "4.8.2",
    "react-native-screens": "3.29.0",
    "react-native-tab-view": "3.5.2",
    "react-native-vision-camera": "3.9.1",
    "react-native-webview": "13.6.4",
    "react-redux": "8.1.3",
    "redux": "4.2.1",
    "redux-form": "8.3.10",
    "redux-persist": "6.0.0",
    "redux-saga": "1.3.0",
    "reselect": "4.0.0",
    "typed-redux-saga": "1.5.0",
    "url-parse": "1.5.10",
    "url-pattern": "1.0.3"
  },