firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.69k stars 3.97k forks source link

[firebase_auth]: AuthBackendRPCImplementation crash #13553

Open eli1stark opened 2 days ago

eli1stark commented 2 days ago

Is there an existing issue for this?

Which plugins are affected?

Auth

Which platforms are affected?

iOS

Description

Since we released the version of our app on Oct 10th, these crashes started happening. We had v5.3.0 of firebase_auth, and we weren't updating anything, so it might be something related to the recent updates of FirebaseExtension which is fetched automatically by Podfile while the app is built. Since we updated to v5.3.1 of firebase_auth and released a new app version on Oct 22nd, these crashes have increased in frequency and are now impacting around 50 of our users, with this number growing. It's hard to make sense of the error itself, but it seems related to sign-up. Also, it's interesting that this crash happens in the first second of user sessions, as per Crashlytics, which makes it even more puzzling.

Screenshot 2024-10-24 at 10 01 55 PM

Couple of crashes:

          Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x3fde58 swift_unknownObjectRetain + 8
1  FirebaseAuth                   0xa0738 $s12FirebaseAuth0B24BackendRPCImplementation33_CDD8170B2D2F91DA2FEF3E7A88D6BF38LLC12callInternal4with8ResponseQzx_tYaKAA0B10RPCRequestRzlFAA18SecureTokenRequestC_Tg5TY0_ + 604
2  libswift_Concurrency.dylib     0x41ac4 <redacted> + 436
3  libswift_Concurrency.dylib     0x43dc4 <redacted> + 1164
4  libswift_Concurrency.dylib     0x41ab0 <redacted> + 416
5  libswift_Concurrency.dylib     0x42d54 <redacted> + 72
6  libdispatch.dylib              0x15be4 <redacted> + 392
7  libdispatch.dylib              0x163ec <redacted> + 156
8  libsystem_pthread.dylib        0x1928 _pthread_wqthread + 228
9  libsystem_pthread.dylib        0x1a04 start_wqthread + 8
          Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x4388c8 swift_unknownObjectRetain + 8
1  FirebaseAuth                   0xa0738 $s12FirebaseAuth0B24BackendRPCImplementation33_CDD8170B2D2F91DA2FEF3E7A88D6BF38LLC12callInternal4with8ResponseQzx_tYaKAA0B10RPCRequestRzlFAA18SecureTokenRequestC_Tg5TY0_ + 604
2  libswift_Concurrency.dylib     0x610e4 swift::runJobInEstablishedExecutorContext(swift::Job*) + 252
3  libswift_Concurrency.dylib     0x624f4 swift_job_runImpl(swift::Job*, swift::SerialExecutorRef) + 144
4  libdispatch.dylib              0x15d8c _dispatch_root_queue_drain + 392
5  libdispatch.dylib              0x16590 _dispatch_worker_thread2 + 156
6  libsystem_pthread.dylib        0x4c40 _pthread_wqthread + 228
7  libsystem_pthread.dylib        0x1488 start_wqthread + 8
      Crashed: com.apple.root.user-initiated-qos.cooperative
0  libswiftCore.dylib             0x4388c8 swift_unknownObjectRetain + 8
1  FirebaseAuth                   0xa0738 $s12FirebaseAuth0B24BackendRPCImplementation33_CDD8170B2D2F91DA2FEF3E7A88D6BF38LLC12callInternal4with8ResponseQzx_tYaKAA0B10RPCRequestRzlFAA18SecureTokenRequestC_Tg5TY0_ + 604
2  libswift_Concurrency.dylib     0x610e4 swift::runJobInEstablishedExecutorContext(swift::Job*) + 252
3  libswift_Concurrency.dylib     0x63a08 (anonymous namespace)::ProcessOutOfLineJob::process(swift::Job*) + 480
4  libswift_Concurrency.dylib     0x611a4 swift::runJobInEstablishedExecutorContext(swift::Job*) + 444
5  libswift_Concurrency.dylib     0x624f4 swift_job_runImpl(swift::Job*, swift::SerialExecutorRef) + 144
6  libdispatch.dylib              0x15d8c _dispatch_root_queue_drain + 392
7  libdispatch.dylib              0x16590 _dispatch_worker_thread2 + 156
8  libsystem_pthread.dylib        0x4c40 _pthread_wqthread + 228
9  libsystem_pthread.dylib        0x1488 start_wqthread + 8

Reproducing the issue

This crash only impacts iOS devices. We went through all possible auth scenarios in our app, and we couldn't reproduce it locally in debug mode. However, we were able to reproduce it with our production build, the app indeed crashes in the first second of the session. We recorded crashes on iOS 17 and iOS 18.

Firebase Core version

3.6.0

Flutter Version

3.24.3

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
```yaml firebase_core: 3.6.0 firebase_crashlytics: 4.1.3 firebase_analytics: 11.3.3 firebase_dynamic_links: 6.0.8 firebase_app_check: 0.3.1+2 firebase_auth: 5.3.1 firebase_database: 11.1.4 firebase_performance: 0.10.0+7 firebase_remote_config: 5.1.3 cloud_firestore: 5.4.4 cloud_functions: 5.1.2 firebase_app_installations: 0.3.1+3 ```

Additional context and comments

Similar issues:

  1. https://github.com/firebase/firebase-ios-sdk/issues/13650
  2. https://github.com/firebase/firebase-ios-sdk/issues/13761

It doesn't seem that Firebase Apple 11.4.0 fixed the issue or flutter package is using older version of iOS plugin.

eli1stark commented 2 days ago

Is there a way for us to quickly patch it to production based on Firebase Apple v11.4.0?

eli1stark commented 2 days ago

Impact: It's currently affecting all iOS devices that are using versions of the apps built post-Oct. 10th (maybe even earlier) and using v3.5.0, v3.6.0 of firebase_core and v3.5.0 and v3.5.1 of firebase_auth. All iOS devices are crashing randomly (sometimes they do and sometimes they don't) within the first seconds of a user session in production.

eli1stark commented 2 days ago

Related: https://github.com/firebase/flutterfire/issues/13451