invertase / react-native-firebase

πŸ”₯ A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.66k stars 2.21k forks source link

[πŸ›] Collection.add call hang indefinitely on some iOS devices. #4584

Closed TrustyTechSG closed 3 years ago

TrustyTechSG commented 3 years ago

Issue

Simple collection.add call hang for very long time. Only happened on some iOS devices, Android works fine.

await firestore().collection(xxxxxx).add(data); // Keep waiting no return or error throw.

Xcode log we saw log below during starting, we did follow the setup flow to add the [FIRApp configure] statement, but still see this log, not sure whether it related.

[Firebase/Core][I-COR000003] The default Firebase app has not yet been configured. Add [FIRApp configure]; (FirebaseApp.configure() in Swift) to your application initialization. Read more: https://goo.gl/ctyzm8.

Describe your issue here


Project Files

Javascript

import firestore from '@react-native-firebase/firestore';

const onTest = async () => { await firestore().collection(collectionPath).add(data); };

package.json:

{
  "scripts": {
    "start": "react-native start",
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "web": "expo start --web",
    "postinstall": "npx jetify",
    "publish": "expo publish --release-channel easybus",
    "log": "adb logcat --pid=`adb shell pidof app.easybus.driver`"
  },
  "dependencies": {
    "@react-native-community/datetimepicker": "^3.0.4",
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.6",
    "@react-native-community/viewpager": "4.1.6",
    "@react-native-firebase/app": "^10.0.0",
    "@react-native-firebase/auth": "^10.0.0",
    "@react-native-firebase/firestore": "^10.0.0",
    "@react-native-firebase/functions": "^10.0.0",
    "@react-native-firebase/ml": "^10.0.0",
    "@react-native-firebase/storage": "^10.0.0",
    "@react-native-mapbox-gl/maps": "^8.1.0-rc.9",
    "@react-navigation/bottom-tabs": "^5.11.1",
    "@react-navigation/native": "^5.8.9",
    "@react-navigation/stack": "^5.12.6",
    "@terrylinla/react-native-sketch-canvas": "^0.8.0",
    "Base64": "^1.1.0",
    "add": "^2.0.6",
    "base-64": "^0.1.0",
    "buffer": "^5.5.0",
    "esc-pos-encoder": "^1.3.0",
    "expo": "^39.0.0",
    "expo-av": "~8.6.0",
    "expo-constants": "~9.2.0",
    "expo-file-system": "~9.2.0",
    "expo-gl": "~9.1.1",
    "expo-image-manipulator": "~8.3.0",
    "expo-image-picker": "~9.1.0",
    "expo-localization": "~9.0.0",
    "expo-location": "~9.0.0",
    "expo-notifications": "~0.7.2",
    "expo-permissions": "~9.3.0",
    "expo-speech": "~8.4.0",
    "expo-splash-screen": "^0.6.2",
    "expo-task-manager": "~8.5.0",
    "expo-updates": "~0.3.3",
    "geolib": "^3.2.1",
    "jetifier": "^1.6.5",
    "moment": "^2.24.0",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "react-native": "0.63.3",
    "react-native-bluetooth-escpos-printer": "https://github.com/januslo/react-native-bluetooth-escpos-printer.git",
    "react-native-calendars": "^1.403.0",
    "react-native-camera": "^3.40.0",
    "react-native-dialog": "^5.6.0",
    "react-native-draggable-flatlist": "^2.3.2",
    "react-native-elements": "^1.2.7",
    "react-native-fix-image": "^2.0.1",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-image-crop-picker": "^0.32.2",
    "react-native-image-picker": "^2.3.1",
    "react-native-image-zoom-viewer": "^2.2.27",
    "react-native-intercom": "^17.0.0",
    "react-native-keyevent": "^0.2.8",
    "react-native-modal": "^11.5.6",
    "react-native-modal-datetime-picker": "^9.1.0",
    "react-native-open-maps": "^0.3.4",
    "react-native-paper": "3.10.1",
    "react-native-pickers": "^2.0.0",
    "react-native-progress": "^4.1.2",
    "react-native-qrcode-svg": "^6.0.3",
    "react-native-reanimated": "~1.13.0",
    "react-native-root-siblings": "^4.0.6",
    "react-native-root-toast": "^3.2.0",
    "react-native-safe-area-context": "3.1.4",
    "react-native-safe-area-view": "^1.0.0",
    "react-native-screens": "~2.10.1",
    "react-native-side-menu": "^1.1.3",
    "react-native-svg": "12.1.0",
    "react-native-tab-view": "^2.15.2",
    "react-native-table-component": "^1.2.1",
    "react-native-unimodules": "~0.11.0",
    "react-native-web": "~0.13.7",
    "yarn": "^1.22.10"
  },
  "devDependencies": {
    "@babel/core": "~7.8.6",
    "babel-jest": "~24.9.0",
    "babel-preset-expo": "^8.3.0",
    "jest": "~24.9.0",
    "metro-react-native-babel-preset": "~0.56.4",
    "react-test-renderer": "~16.9.0"
  },
  "private": true
}

firebase.json for react-native-firebase v6:

{
  "react-native": {
    "ml_vision_barcode_model": true
  }
}

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/react-native-unimodules/cocoapods.rb' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' platform :ios, '10.0' target 'ProjectName' do use_unimodules! config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) # Enables Flipper. # # Note that if you have use_frameworks! enabled, Flipper will not work and # you should disable these next few lines. use_flipper! post_install do |installer| flipper_post_install(installer) end end ``` #### `AppDelegate.m`: ```objc // N/A ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 10.15.4 CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz Memory: 2.99 GB / 16.00 GB Shell: 5.7.1 - /bin/zsh Binaries: Node: 12.16.3 - /usr/local/bin/node Yarn: 1.22.4 - /usr/local/bin/yarn npm: 6.14.4 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman Managers: CocoaPods: 1.9.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: iOS 14.2, DriverKit 20.0, macOS 11.0, tvOS 14.2, watchOS 7.1 Android SDK: API Levels: 27, 28, 29 Build Tools: 28.0.3, 29.0.2, 29.0.3 System Images: android-28 | Intel x86 Atom_64, android-29 | Google Play Intel x86 Atom Android NDK: Not Found IDEs: Android Studio: 3.6 AI-192.7142.36.36.6392135 Xcode: 12.2/12B45b - /usr/bin/xcodebuild Languages: Java: 1.8.0_252 - /usr/bin/javac Python: 2.7.16 - /usr/bin/python npmPackages: @react-native-community/cli: Not Found react: 16.13.1 => 16.13.1 react-native: 0.63.3 => 0.63.3 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `10.0.0` - **`Firebase` module(s) you're using that has the issue:** - `` - **Are you using `TypeScript`?** - `N`

mikehardy commented 3 years ago

Unfortunately - unless the data is variable sized and the ones that are hanging are actually just working very hard sending large data across the javascript/native bridge that react-native uses, the most likely resolution will come from reliable reproduction based on the upstream firebase-ios-sdk quickstart and filing it there - https://github.com/firebase/quickstart-ios/tree/master/firestore

Other than bridge latency I can't see how this can be from the react-native-firebase layer, I think it has to be in the SDK

TrustyTechSG commented 3 years ago

Unfortunately - unless the data is variable sized and the ones that are hanging are actually just working very hard sending large data across the javascript/native bridge that react-native uses, the most likely resolution will come from reliable reproduction based on the upstream firebase-ios-sdk quickstart and filing it there - https://github.com/firebase/quickstart-ios/tree/master/firestore

Other than bridge latency I can't see how this can be from the react-native-firebase layer, I think it has to be in the SDK

Yes, we also notice is it caused by large object with many nested fields, but the same write operation with the same object has no problems on Android. so is this a limitation on iOS?

mikehardy commented 3 years ago

I can't say much of anything definitively without a reproduction, so I'll say "I don't know". iOS doesn't have any particular limits that I'm aware of, but maybe you are comparing an iPhone SE (1st Generation) to a OnePlus 7, that is, radically different hardware capability, independent of OS style

stale[bot] commented 3 years ago

Hello πŸ‘‹, to help manage issues we automatically close stale issues. This issue has been automatically marked as stale because it has not had activity for quite some time. Has this issue been fixed, or does it still require the community's attention?

This issue will be closed in 15 days if no further activity occurs. Thank you for your contributions.