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.71k stars 3.97k forks source link

🐛 [cloud_firestore] Crash on startup for iOS 12 #11216

Closed hermuxo closed 1 year ago

hermuxo commented 1 year ago

Bug report

Crash on startup in iOS 12.5.7 (max iOS for iPhone 6, iPhone 5s, iPad Mini 3) with latest firebase libraries. No issues on newer iOS versions. Rolled back Firebase libraries to fix it.

Steps to reproduce

Steps to reproduce the behavior:

  1. iOS app on iPhone 6 with iOS 12.5.7
  2. Latest Firebase Libraries
  3. See error or incorrect behavior
    Crashed: com.google.firebase.firestore
    EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x000000000000cc64
    Crashed: com.google.firebase.firestore
    0  grpcpp                         0x58a8 grpc_core::ExecCtx::ExecCtx() + 156 (time.h:156)
    1  grpcpp                         0x2bb38 grpc::SecureChannelCredentials::~SecureChannelCredentials() + 54 (secure_credentials.h:54)
    2  grpcpp                         0x2bc7c std::__1::__shared_ptr_pointer<grpc::SecureChannelCredentials*, std::__1::shared_ptr<grpc::ChannelCredentials>::__shared_ptr_default_delete<grpc::ChannelCredentials, grpc::SecureChannelCredentials>, std::__1::allocator<grpc::SecureChannelCredentials>>::__on_zero_shared() + 48 (unique_ptr.h:48)
    3  FirebaseFirestore              0x902d4 firebase::firestore::remote::GrpcConnection::CreateChannel() const + 216 (shared_ptr.h:216)
    4  FirebaseFirestore              0x9003c firebase::firestore::remote::GrpcConnection::EnsureActiveStub() + 295 (grpc_connection.cc:295)
    5  FirebaseFirestore              0x90780 firebase::firestore::remote::GrpcConnection::CreateStream(absl::lts_20220623::string_view, firebase::firestore::credentials::AuthToken const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, firebase::firestore::remote::GrpcStreamObserver*) + 343 (grpc_connection.cc:343)
    6  FirebaseFirestore              0x1349b0 firebase::firestore::remote::Stream::ResumeStartWithCredentials(firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 295 (unique_ptr.h:295)
    7  FirebaseFirestore              0x136074 std::__1::__function::__func<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20220623::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken>> const&, absl::lts_20220623::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> const&) const::'lambda'(), std::__1::allocator<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20220623::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken>> const&, absl::lts_20220623::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> const&) const::'lambda'()>, void ()>::operator()() + 173 (shared_ptr.h:173)
    8  FirebaseFirestore              0x91dc firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&) + 945 (atomic:945)
    9  FirebaseFirestore              0x14633c firebase::firestore::util::Task::ExecuteAndRelease() + 498 (function.h:498)
    10 libdispatch.dylib              0x607d4 _dispatch_client_callout + 16
    11 libdispatch.dylib              0x9324 _dispatch_lane_serial_drain$VARIANT$mp + 592
    12 libdispatch.dylib              0x9e40 _dispatch_lane_invoke$VARIANT$mp + 428
    13 libdispatch.dylib              0x124ac _dispatch_workloop_worker_thread + 596
    14 libsystem_pthread.dylib        0xc114 _pthread_wqthread + 304
    15 libsystem_pthread.dylib        0xecd4 start_wqthread + 4

    Expected behavior

Don't crash :)

Sample project

Providing a minimal example project which demonstrates the bug in isolation from your main App greatly enhances the chance of a timely fix. Please link to the public repository URL.


Additional context

Flutter 3.10.5

  firebase_core: ^2.14.0
  firebase_analytics: ^10.4.3
  firebase_crashlytics: ^3.3.3
  firebase_messaging: ^14.6.4
  firebase_remote_config: ^4.2.3
  cloud_firestore: ^4.8.2
  firebase_auth: ^4.6.3
  firebase_dynamic_links: ^5.3.3
  firebase_storage: ^11.2.4
  firebase_in_app_messaging: ^0.7.3+3

Flutter doctor

Run flutter doctor and paste the output below:

Click To Expand ``` PASTE OUTPUT INSIDE HERE ```

Flutter dependencies

Run flutter pub deps -- --style=compact and paste the output below:

Click To Expand ``` PASTE OUTPUT INSIDE HERE ```

danagbemava-nc commented 1 year ago

Hi @hermuxo, is the crash reproducible every time? If so, can you provide the steps to reproduce?

hermuxo commented 1 year ago

Hi @hermuxo, is the crash reproducible every time? If so, can you provide the steps to reproduce?

Unfortunately I don't have an iPhone 6 to reproduce this with but I can see from Crashlytics that ~100% of users with iOS 12 had this issue. I was hoping that creating this ticket might help someone confirm the problem too. Rolling back firebase libraries did solve this issue temporarily.

image
danagbemava-nc commented 1 year ago

Thanks for the info.

Labeling for further insight based on the crash logs shared above

sgraton commented 1 year ago

Hi Same problem for me. @hermuxo What versions did you revert to to fix the issue?

lunivic commented 1 year ago

Hello, we are facing the same issue, although we are not using flutter, the stacktrace looks exactly the same with the same devices as well.

hermuxo commented 1 year ago

@sgraton Hi Same problem for me. @hermuxo What versions did you revert to to fix the issue?

  firebase_analytics: 10.4.2
  firebase_crashlytics: 3.3.2
  firebase_messaging: 14.6.2
  firebase_remote_config: 4.2.2
  cloud_firestore: 4.8.0
  firebase_auth: 4.6.2
  firebase_dynamic_links: 5.3.2
  firebase_storage: 11.2.2
  firebase_in_app_messaging: 0.7.3+2
sgraton commented 1 year ago

@hermuxo And you revert to whitch versions ?

hermuxo commented 1 year ago

@sgraton

These versions had the issue:

  firebase_core: ^2.14.0
  firebase_analytics: ^10.4.3
  firebase_crashlytics: ^3.3.3
  firebase_messaging: ^14.6.4
  firebase_remote_config: ^4.2.3
  cloud_firestore: ^4.8.2
  firebase_auth: ^4.6.3
  firebase_dynamic_links: ^5.3.3
  firebase_storage: ^11.2.4
  firebase_in_app_messaging: ^0.7.3+3

was solved reverting to:

    firebase_core: 2.13.1
  firebase_analytics: 10.4.2
  firebase_crashlytics: 3.3.2
  firebase_messaging: 14.6.2
  firebase_remote_config: 4.2.2
  cloud_firestore: 4.8.0
  firebase_auth: 4.6.2
  firebase_dynamic_links: 5.3.2
  firebase_storage: 11.2.2
  firebase_in_app_messaging: 0.7.3+2
fleoparra commented 1 year ago

Hello. With these versions the issue continues:

  firebase_core: ^2.15.0
  firebase_analytics: ^10.4.4
  firebase_crashlytics: ^3.3.4
  firebase_remote_config: ^4.2.4
  firebase_messaging: ^14.6.5
  cloud_firestore: ^4.8.4
rathodbhavikkqc commented 1 year ago

We are also facing the same issue in our iOS 12.5.7 Device (iPhone 6), We are also facing the same issue in iOS 14.0 simulator

Crashed: com.google.firebase.firestore
0  grpcpp                         0x52a8 grpc_core::ExecCtx::ExecCtx() + 112
1  grpcpp                         0x2b538 grpc::SecureChannelCredentials::~SecureChannelCredentials() + 28
2  grpcpp                         0x2b67c std::__1::__shared_ptr_pointer<grpc::SecureChannelCredentials*, std::__1::shared_ptr<grpc::ChannelCredentials>::__shared_ptr_default_delete<grpc::ChannelCredentials, grpc::SecureChannelCredentials>, std::__1::allocator<grpc::SecureChannelCredentials> >::__on_zero_shared() + 20
3  FirebaseFirestore              0x90f48 firebase::firestore::remote::GrpcConnection::CreateChannel() const + 424
4  FirebaseFirestore              0x90cb0 firebase::firestore::remote::GrpcConnection::EnsureActiveStub() + 128
5  FirebaseFirestore              0x913f4 firebase::firestore::remote::GrpcConnection::CreateStream(absl::lts_20220623::string_view, firebase::firestore::credentials::AuthToken const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, firebase::firestore::remote::GrpcStreamObserver*) + 60
6  FirebaseFirestore              0x136bf4 firebase::firestore::remote::Stream::ResumeStartWithCredentials(firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 132
7  FirebaseFirestore              0x1382b8 std::__1::__function::__func<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20220623::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> > const&, absl::lts_20220623::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) const::'lambda'(), std::__1::allocator<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20220623::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> > const&, absl::lts_20220623::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) const::'lambda'()>, void ()>::operator()() + 72
8  FirebaseFirestore              0x8bbc firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&) + 68
9  FirebaseFirestore              0x148d80 firebase::firestore::util::Task::ExecuteAndRelease() + 184
10 libdispatch.dylib              0x607d4 _dispatch_client_callout + 16
11 libdispatch.dylib              0x9324 _dispatch_lane_serial_drain$VARIANT$mp + 592
12 libdispatch.dylib              0x9e40 _dispatch_lane_invoke$VARIANT$mp + 428
13 libdispatch.dylib              0x124ac _dispatch_workloop_worker_thread + 596
14 libsystem_pthread.dylib        0xc114 _pthread_wqthread + 304
15 libsystem_pthread.dylib        0xecd4 start_wqthread + 4
baothgvinamilk commented 1 year ago
Crashed: com.google.firebase.firestore
0  grpcpp                         0x86f0 grpc_core::ExecCtx::ExecCtx() + 156 (time.h:156)
1  grpcpp                         0x2fc3c grpc::SecureChannelCredentials::~SecureChannelCredentials() + 54 (secure_credentials.h:54)
2  grpcpp                         0x2fe40 std::__1::__shared_ptr_pointer<grpc::SecureChannelCredentials*, std::__1::shared_ptr<grpc::ChannelCredentials>::__shared_ptr_default_delete<grpc::ChannelCredentials, grpc::SecureChannelCredentials>, std::__1::allocator<grpc::SecureChannelCredentials> >::__on_zero_shared() + 57 (unique_ptr.h:57)
3  FirebaseFirestore              0x93814 firebase::firestore::remote::GrpcConnection::CreateChannel() const + 220 (shared_ptr.h:220)
4  FirebaseFirestore              0x93544 firebase::firestore::remote::GrpcConnection::EnsureActiveStub() + 869 (shared_ptr.h:869)
5  FirebaseFirestore              0x93d34 firebase::firestore::remote::GrpcConnection::CreateStream(absl::lts_20220623::string_view, firebase::firestore::credentials::AuthToken const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, firebase::firestore::remote::GrpcStreamObserver*) + 343 (grpc_connection.cc:343)
6  FirebaseFirestore              0x141f94 firebase::firestore::remote::Stream::ResumeStartWithCredentials(firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 308 (unique_ptr.h:308)
7  FirebaseFirestore              0x1434c4 std::__1::__function::__func<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20220623::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> > const&, absl::lts_20220623::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) const::'lambda'(), std::__1::allocator<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20220623::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken> > const&, absl::lts_20220623::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > const&) const::'lambda'()>, void ()>::operator()() + 176 (shared_ptr.h:176)
8  FirebaseFirestore              0x8d50 firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&) + 997 (atomic:997)
9  FirebaseFirestore              0x154cf4 firebase::firestore::util::Task::ExecuteAndRelease() + 491 (function.h:491)
10 libdispatch.dylib              0x607d4 _dispatch_client_callout + 16
11 libdispatch.dylib              0x9324 _dispatch_lane_serial_drain$VARIANT$mp + 592
12 libdispatch.dylib              0x9e40 _dispatch_lane_invoke$VARIANT$mp + 428
13 libdispatch.dylib              0x124ac _dispatch_workloop_worker_thread + 596
14 libsystem_pthread.dylib        0xc114 _pthread_wqthread + 304
15 libsystem_pthread.dylib        0xecd4 start_wqthread + 4

firebase_core: 2.15.0 firebase_analytics: 10.4.4 firebase_auth: 4.7.1 firebase_crashlytics: 3.3.4 firebase_remote_config: 4.2.4 cloud_firestore: 4.8.3

I also had the app crash on OS version: iOS 12.4.1 Model: iPhone 6s Plus Are there any new versions of firebase that have been fixed or are they being worked on?

danagbemava-nc commented 1 year ago

It turns out this is an issue with the firebase_ios_sdk. It looks like an incompatibility between cocoapods and gprc. See https://github.com/firebase/firebase-ios-sdk/issues/11509. They recently downgraded the grpc version, but the issue is also being tracked internally at google.

cc @russellwheatley

luttmfra commented 1 year ago

Please update with Firebase iOS SDK 10.16.0 to fix it: https://firebase.google.com/support/release-notes/ios