cordova-plugin-firebasex icon indicating copy to clipboard operation
cordova-plugin-firebasex copied to clipboard

iOS App crashes Fatal Exception: NSInvalidArgumentException

Open almothafar opened this issue 3 years ago • 11 comments

CHECKLIST

  • [ ] I have reproduced the issue using the example project or provided the necessary information to reproduce the issue.
  • [x] I have checked that no similar issues (open or closed) already exist.

I don't know wif there is duplicates many users got crashes issues and most of the tickets closed unsolved.

Current behavior: We got many reports of users getting crashes, for now, we don't have many users in our app but crashlytics reported 27 crashes for 5 iOS users last 7 days which is too much, the crash details will be provided here.

Expected behavior: App to be stable and don't get crashes.

Steps to reproduce: I really can't provide a specific way to reproduce it, from the iOS test device I don't see these crashes, while users reported that and I see them in crashlytics.

Screenshots

Environment information

  • Cordova CLI version

    • 10.0.0
  • Cordova platform version

    • cordova-android 9.0.0
    • cordova-ios 6.2.0
  • Plugins & versions installed in project (including this plugin)

    • cordova-plugin-app-version 0.1.12 "AppVersion"
    • cordova-plugin-badge 0.8.8 "Badge"
    • cordova-plugin-device 2.0.3 "Device"
    • cordova-plugin-file-opener2 3.0.5 "File Opener2"
    • cordova-plugin-file 6.0.2 "File"
    • cordova-plugin-firebasex 12.1.0 "Google Firebase Plugin"
    • cordova-plugin-geolocation 4.1.0 "Geolocation"
    • cordova-plugin-inappbrowser 5.0.0 "InAppBrowser"
    • cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
    • cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
    • cordova-plugin-splashscreen 6.0.0 "Splashscreen"
    • cordova-plugin-statusbar 2.4.3 "StatusBar"
    • cordova-plugin-whitelist 1.3.4 "Whitelist"
    • cordova-plugin-x-socialsharing 6.0.3 "SocialSharing"
    • cordova-sqlite-storage 6.0.0 "Cordova SQLite storage plugin - cordova-sqlite-storage plugin version"
    • es6-promise-plugin 4.2.2 "Promise"
    • phonegap-plugin-barcodescanner 8.1.0 "BarcodeScanner"
    • uk.co.workingedge.phonegap.plugin.launchnavigator 5.0.5 "Launch Navigator"
  • Dev machine OS and version

    • ProductName: Mac OS X
      • ProductVersion: 10.15.7
      • BuildVersion: 19H2

    And

    • Windows 10
      • Version 20H2 Build 19042.985

Runtime issue

  • Device details
    • iPhone
  • OS details
    • iOS 14.4.0, iOS 14.6.0

iOS build issue: (there is no build issue but just to give more details)

  • Node JS version
    • v10.15.0
  • XCode version
    • 12.4 (12D4e)

Console output

console output

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x187a2986c __exceptionPreprocess
1  libobjc.A.dylib                0x19ca44c50 objc_exception_throw
2  CoreFoundation                 0x18793095c -[NSOrderedSet initWithSet:copyItems:]
3  CoreFoundation                 0x187a2c438 ___forwarding___
4  CoreFoundation                 0x187a2e740 _CF_forwarding_prep_0
5  FirebaseCrashlytics            0x1058d8ab4 (Missing)
6  FirebaseCrashlytics            0x1058d8f44 (Missing)
7  libdispatch.dylib              0x18761ddb0 _dispatch_client_callout
8  libdispatch.dylib              0x18762c428 _dispatch_lane_barrier_sync_invoke_and_complete
9  FirebaseCrashlytics            0x1058d89e4 (Missing)
10 FirebaseCrashlytics            0x1058d88f8 (Missing)
11 ********                        0x104f2530c __27-[FirebasePlugin logError:]_block_invoke + 1191 (FirebasePlugin.m:1191)
12 libdispatch.dylib              0x18761c24c _dispatch_call_block_and_release
13 libdispatch.dylib              0x18761ddb0 _dispatch_client_callout
14 libdispatch.dylib              0x187620ddc _dispatch_queue_override_invoke
15 libdispatch.dylib              0x18762e93c _dispatch_root_queue_drain
16 libdispatch.dylib              0x18762f120 _dispatch_worker_thread2
17 libsystem_pthread.dylib        0x1d34d97d8 _pthread_wqthread
18 libsystem_pthread.dylib        0x1d34e076c start_wqthread

Crashed: com.google.firebase.crashlytics.ios.exception
0  FirebaseCrashlytics            0x105310434 FIRCLSProcessRecordAllThreads + 180
1  FirebaseCrashlytics            0x105310818 FIRCLSProcessRecordAllThreads + 1176
2  FirebaseCrashlytics            0x1053095a0 FIRCLSHandler + 48
3  FirebaseCrashlytics            0x105303d1c __FIRCLSExceptionRecord_block_invoke + 92
4  libdispatch.dylib              0x1a311781c _dispatch_client_callout + 20
5  libdispatch.dylib              0x1a3126910 _dispatch_lane_barrier_sync_invoke_and_complete + 60
6  FirebaseCrashlytics            0x1053034b4 FIRCLSExceptionRecord + 212
7  FirebaseCrashlytics            0x1053037ac FIRCLSExceptionRecordNSException + 536
8  FirebaseCrashlytics            0x105303094 FIRCLSTerminateHandler() + 400
9  libc++abi.dylib                0x1b80d1fa0 std::__terminate(void (*)()) + 20
10 libc++abi.dylib                0x1b80d1f2c std::terminate() + 48
11 libobjc.A.dylib                0x1b7ff191c objc_terminate + 16
12 libdispatch.dylib              0x1a3117830 _dispatch_client_callout + 40
13 libdispatch.dylib              0x1a3126910 _dispatch_lane_barrier_sync_invoke_and_complete + 60
14 FirebaseCrashlytics            0x10531c9e4 FIRCLSUserLoggingWriteAndCheckABFiles + 164
15 FirebaseCrashlytics            0x10531c8f8 FIRCLSUserLoggingRecordError + 228
16 ********                        0x10496930c __27-[FirebasePlugin logError:]_block_invoke + 1191 (FirebasePlugin.m:1191)
17 libdispatch.dylib              0x1a3115a84 _dispatch_call_block_and_release + 32
18 libdispatch.dylib              0x1a311781c _dispatch_client_callout + 20
19 libdispatch.dylib              0x1a311a968 _dispatch_queue_override_invoke + 756
20 libdispatch.dylib              0x1a3128fe0 _dispatch_root_queue_drain + 388
21 libdispatch.dylib              0x1a31297d8 _dispatch_worker_thread2 + 112
22 libsystem_pthread.dylib        0x1ef08e768 _pthread_wqthread + 216
23 libsystem_pthread.dylib        0x1ef09574c start_wqthread + 8



Other information:

image

One of users:

image

almothafar avatar Jun 02 '21 10:06 almothafar

Hey @almothafar, how is your app behaving 21 days later? Still many crashes? Can you update your stats here? Have you found a solution to the problem?

mreis1 avatar Jun 23 '21 11:06 mreis1

@mreis1 it is still happening

image

With many users with different iOS versions and iPhones:

image

image

image

almothafar avatar Jun 23 '21 13:06 almothafar

Don't known if this was fixed but I noticed you are using firebasex version 12.0.0 Recently many fixes were made and released under version 13.

mreis1 avatar Jun 23 '21 16:06 mreis1

@mreis1 that release got published 8 days ago, and this issue opened 23 days ago, the plugin is updated in dev and will keep monitoring that next release.

almothafar avatar Jun 24 '21 23:06 almothafar

This issue might be related: https://github.com/dpa99c/cordova-plugin-firebasex/issues/576 In my case I was caused by passing the wrong param/callback as something changed in the function call to the plugin. If you (also) happen to do a version upgrade that might be worth investigating.

spoxies avatar Jun 29 '21 13:06 spoxies

@spoxies from my side I don't call any login or verifications.

almothafar avatar Jun 29 '21 13:06 almothafar

@dpa99c can someone look into this issue, please? My app now getting rejected because of this issue, there are many similar crashes reported here not sure if they related or not but I think they closed without resolution, I hope this will not end with getting closed as well. Meanwhile, I'll look into alternatives, I don't think it is wise for me to keep using this plugin.

image

almothafar avatar Jul 02 '21 07:07 almothafar

@mreis1 I can confirm it is still happening in version 13 as well.

almothafar avatar Jul 02 '21 07:07 almothafar

@almothafar there's not sufficient information in this issue to pin down the cause and I'm not experiencing any such crashes in my own apps. Looking at the stacktraces, the crash happens down in FirebaseCrashlytics so I'd say 99% that the cause is a bad value (e.g. unsupported type) being passed down via this plugin's logError method. I would suggest looking at what values you are passing into logError and whether those can trigger the crash. Without a procedure to reproduce the crash, it's hard to diagnose/fix it; e.g. if a particular type is causing the crash, then type checking can be added to logError so it fails with an error callback rather than an app crash if that particular type is passed in as an input parameter.

dpa99c avatar Jul 02 '21 08:07 dpa99c

@dpa99c Thanks for the response, that's should help me a little, but for me, I just need to know if there is any idea to verify values, or if there is anything "try/catch" thing that can be done in the plugin itself.

Personally, I tried to reproduce the issue in my test device, I tried every single way and can't reproduce it, so I have no idea what that kind of value that breaking the app.

But a few clients complaining about this, and 2 times from Apple the app got rejected because of it, backtrace mentioning FirebaseCrashlytics but because this is a hybrid app even backtrace is not really that helpful.

almothafar avatar Jul 02 '21 08:07 almothafar

I just need to know if there is any idea to verify values

The stacktrace for your crashes arises on line 1191 and therefore indicates you are passing in a JS stacktrace in order for recordExceptionModel to be called (otherwise recordError would be called) so check that this stacktrace is valid e.g. doesn't contain Javascript function objects. You could try omitting the stacktrace and this would probably stop the crashes.

Also check what values are being sent as errorMessage as this is being cast to NSString*.

if there is anything "try/catch" thing that can be done in the plugin itself.

The call to Crashlytics is already wrapped in a try/catch statement so presumably Crashlytics is performing the offending operation on a different thread and hence the exception is not being caught.

dpa99c avatar Jul 02 '21 08:07 dpa99c