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

App Crash from Firebase Remote Config #13193

Open
nik6018 opened this issue Jun 27, 2024 · 5 comments
Open

App Crash from Firebase Remote Config #13193

nik6018 opened this issue Jun 27, 2024 · 5 comments

Comments

@nik6018
Copy link

nik6018 commented Jun 27, 2024

Description

The app is crashing immediately after opening, as indicated from Crashlytics as it's tagged under "Early crashes". The crash is happening randomly.

When the app starts up I have made sure that func fetch( withExpirationDuration expirationDuration: , completionHandler: ((RemoteConfigFetchStatus, ?) -> [Void])? = nil ) method is only invoked once to avoid any multiple calls

I am also using RemoteConfigRealTimeUpdate as well to fetch latest values whenever changes happen.

Can anyone provide me guidance on how I can resolve this crash as it's pointing to RCNConfigRealtime.m:449 and I have no insight on what's causing it

Reproducing the issue

Unable to reproduce the issue, as it's occurring on very rare instances on production

Firebase SDK Version

10.22.1

Xcode Version

15.3

Installation Method

Swift Package Manager

Firebase Product(s)

Crashlytics, DynamicLinks, Remote Config

Targeted Platforms

iOS

Relevant Log Output

Fatal Exception: NSGenericException
0  CoreFoundation                 0x83f20 __exceptionPreprocess
1  libobjc.A.dylib                0x16018 objc_exception_throw
2  CoreFoundation                 0x18220c -[__NSSingleObjectEnumerator init]
3  My App                         0x11c3b64 __53-[RCNConfigRealtime fetchLatestConfig:targetVersion:]_block_invoke_2 + 449 (RCNConfigRealtime.m:449)
4  libdispatch.dylib              0x213c _dispatch_call_block_and_release
5  libdispatch.dylib              0x3dd4 _dispatch_client_callout
6  libdispatch.dylib              0x125a4 _dispatch_main_queue_drain
7  libdispatch.dylib              0x121b8 _dispatch_main_queue_callback_4CF
8  CoreFoundation                 0x56710 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
9  CoreFoundation                 0x53914 __CFRunLoopRun
10 CoreFoundation                 0x52cd8 CFRunLoopRunSpecific
11 GraphicsServices               0x11a8 GSEventRunModal
12 UIKitCore                      0x40a90c -[UIApplication _run]
13 UIKitCore                      0x4be9d0 UIApplicationMain
14 My App                         0x4daa78 main + 28 (AppDelegate.swift:28)
15 ???                            0x1bbb35e4c (Missing)

If using Swift Package Manager, the project's Package.resolved

Expand Package.resolved snippet
{
  "originHash" : "54c03b93d8f550adc63162122e1f1f93eb0a1b63d867541427cea29d6081b683",
  "pins" : [
    {
      "identity" : "abseil-cpp-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/abseil-cpp-binary.git",
      "state" : {
        "revision" : "df308b8b46607675f2b9ec8e569109008f9155ce",
        "version" : "1.2022062300.1"
      }
    },
    {
      "identity" : "alamofire",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Alamofire/Alamofire.git",
      "state" : {
        "revision" : "f455c2975872ccd2d9c81594c658af65716e9b9a",
        "version" : "5.9.1"
      }
    },
    {
      "identity" : "app-check",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/app-check.git",
      "state" : {
        "revision" : "3b62f154d00019ae29a71e9738800bb6f18b236d",
        "version" : "10.19.2"
      }
    },
    {
      "identity" : "firebase-ios-sdk",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/firebase-ios-sdk",
      "state" : {
        "revision" : "be49849dcba96f2b5ee550d4eceb2c0fa27dade4",
        "version" : "10.22.1"
      }
    },
    {
      "identity" : "googleappmeasurement",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleAppMeasurement.git",
      "state" : {
        "revision" : "482cfa4e5880f0a29f66ecfd60c5a62af28bd1f0",
        "version" : "10.22.1"
      }
    },
    {
      "identity" : "googledatatransport",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleDataTransport.git",
      "state" : {
        "revision" : "a637d318ae7ae246b02d7305121275bc75ed5565",
        "version" : "9.4.0"
      }
    },
    {
      "identity" : "googleutilities",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/GoogleUtilities.git",
      "state" : {
        "revision" : "57a1d307f42df690fdef2637f3e5b776da02aad6",
        "version" : "7.13.3"
      }
    },
    {
      "identity" : "grpc-binary",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/grpc-binary.git",
      "state" : {
        "revision" : "ea4cb5cc0c39c732b85386263116d2e2fdbbdc61",
        "version" : "1.49.2"
      }
    },
    {
      "identity" : "gtm-session-fetcher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/gtm-session-fetcher.git",
      "state" : {
        "revision" : "0382ca27f22fb3494cf657d8dc356dc282cd1193",
        "version" : "3.4.1"
      }
    },
    {
      "identity" : "interop-ios-for-google-sdks",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/interop-ios-for-google-sdks.git",
      "state" : {
        "revision" : "2d12673670417654f08f5f90fdd62926dc3a2648",
        "version" : "100.0.0"
      }
    },
    {
      "identity" : "kingfisher",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/onevcat/Kingfisher.git",
      "state" : {
        "revision" : "2ef543ee21d63734e1c004ad6c870255e8716c50",
        "version" : "7.12.0"
      }
    },
    {
      "identity" : "leveldb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/leveldb.git",
      "state" : {
        "revision" : "a0bc79961d7be727d258d33d5a6b2f1023270ba1",
        "version" : "1.22.5"
      }
    },
    {
      "identity" : "libwebp-xcode",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/SDWebImage/libwebp-Xcode.git",
      "state" : {
        "revision" : "b2b1d20a90b14d11f6ef4241da6b81c1d3f171e4",
        "version" : "1.3.2"
      }
    },
    {
      "identity" : "lottie-ios",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/airbnb/lottie-ios",
      "state" : {
        "revision" : "769b88d83a42ca8d5572b020c96f47e3690b3796",
        "version" : "4.4.3"
      }
    },
    {
      "identity" : "nanopb",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/firebase/nanopb.git",
      "state" : {
        "revision" : "b7e1104502eca3a213b46303391ca4d3bc8ddec1",
        "version" : "2.30910.0"
      }
    },
    {
      "identity" : "panmodal",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/slackhq/PanModal.git",
      "state" : {
        "revision" : "b012aecb6b67a8e46369227f893c12544846613f",
        "version" : "1.2.7"
      }
    },
    {
      "identity" : "promises",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/google/promises.git",
      "state" : {
        "revision" : "540318ecedd63d883069ae7f1ed811a2df00b6ac",
        "version" : "2.4.0"
      }
    },
    {
      "identity" : "reachability.swift",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/ashleymills/Reachability.swift",
      "state" : {
        "branch" : "master",
        "revision" : "7cbd73f46a7dfaeca079e18df7324c6de6d1834a"
      }
    },
    {
      "identity" : "sdwebimage",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/SDWebImage/SDWebImage.git",
      "state" : {
        "revision" : "b8523c1642f3c142b06dd98443ea7c48343a4dfd",
        "version" : "5.19.3"
      }
    },
    {
      "identity" : "sdwebimagewebpcoder",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/SDWebImage/SDWebImageWebPCoder.git",
      "state" : {
        "revision" : "f534cfe830a7807ecc3d0332127a502426cfa067",
        "version" : "0.14.6"
      }
    },
    {
      "identity" : "skeletonview",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/Juanpe/SkeletonView.git",
      "state" : {
        "revision" : "2f5274827d310e32c09325dd3e0007120940988e",
        "version" : "1.31.0"
      }
    },
    {
      "identity" : "snapshotkit",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/YK-Unit/SnapshotKit.git",
      "state" : {
        "revision" : "79452a8560f9caef218f46fecc46eb7615222b97",
        "version" : "0.3.2"
      }
    },
    {
      "identity" : "swift-protobuf",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/apple/swift-protobuf.git",
      "state" : {
        "revision" : "9f0c76544701845ad98716f3f6a774a892152bcb",
        "version" : "1.26.0"
      }
    },
    {
      "identity" : "swiftygif",
      "kind" : "remoteSourceControl",
      "location" : "https://github.com/kirualex/SwiftyGif.git",
      "state" : {
        "revision" : "4430cbc148baa3907651d40562d96325426f409a",
        "version" : "5.4.5"
      }
    }
  ],
  "version" : 3
}

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet
Replace this line with the contents of your Podfile.lock!
@nik6018
Copy link
Author

nik6018 commented Jun 27, 2024

@rizafran I apologise as I wasn't able to follow up on the similar issue I opend last time, as the crash died down significantly.

But now with the updated release, the crashes have increased

I have tried to use the atos command using the memory address but it's not helpful, as it gives the same text as the crash report.

@paulb777
Copy link
Member

@nik6018 Does the listener get called? Does modifying it make any difference?

@nik6018
Copy link
Author

nik6018 commented Jun 28, 2024

Yes the listener is called and data is fetched from Remote Config, whenever we change values on the Dashboard. That flow is working is perfectly.

We're seeing lots of non fatals For RemoteConfigRealTime that we have logged when the listener error's out.
Though this error is mostly triggered when internet connectivity is very low.

Non-fatal: Error
0  My App                        0x15555a4 FIRCLSUserLoggingRecordError + 393 (FIRCLSUserLogging.m:393)
1  My App                        0x60ed84 closure #1 in RemoteConfigRealTimeUpdateManager.startListening() + 95 (RemoteConfigRealTimeUpdateManager.swift:95)
2  My App                         0x60f2a4 thunk for @escaping @callee_guaranteed (@guaranteed FIRRemoteConfigUpdate?, @guaranteed Error?) -> () (<compiler-generated>)
3  My App                          0x11c688c __37-[RCNConfigRealtime propogateErrors:]_block_invoke + 161 (RCNConfigRealtime.m:161)
4  libdispatch.dylib              0x26a8 _dispatch_call_block_and_release
5  libdispatch.dylib              0x4300 _dispatch_client_callout
6  libdispatch.dylib              0xb894 _dispatch_lane_serial_drain
7  libdispatch.dylib              0xc3c4 _dispatch_lane_invoke
8  libdispatch.dylib              0x17004 _dispatch_root_queue_drain_deferred_wlh
9  libdispatch.dylib              0x16878 _dispatch_workloop_worker_thread
10 libsystem_pthread.dylib        0x1964 _pthread_wqthread
11 libsystem_pthread.dylib        0x1a04 start_wqthread

@paulb777
Copy link
Member

Can you share the listener implementation?

@nik6018
Copy link
Author

nik6018 commented Jul 3, 2024

Here is the implementation:

func startListening() {
        
        self.configListner = self.remoteConfig.addOnConfigUpdateListener { configUpdate, error in
            guard let configUpdate, error == nil else {
                print("Error listening for config updates: \(error)")
                
                // Log the Non-fatal crash
                let userInfo: [String: Any] = ["userId": usercontext.userId,
                                               "error": error!.localizedDescription]
                
                let err = NSError.init(domain: "Firebase.RemoteConfig.RealTimeUpdate", code: -1, userInfo: userInfo)
                Crashlytics.crashlytics().record(error: err)
                Crashlytics.crashlytics().setUserID(usercontext.userId)
                
                return
            }
            
            // To log which keys have been updated
            let updatedKeysString = configUpdate.updatedKeys.reduce(into: "") { partialResult, nextElement in
                partialResult += nextElement
            }
            
            self.fetchData() // Fetch the actual data from Remote Config
        }
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants