grpc: Intermittent crash at grpc::GrpcLibraryCodegen::GrpcLibraryCodegen(bool) in grpc_library.h:45

What version of gRPC and what language are you using?

1.28.0 and 1.44.0

What operating system (Linux, Windows,…) and version?

iOS

What runtime / compiler are you using (e.g. python version or version of gcc)

Xcode 13.3, 13.4 (possibly others)

What did you do?

Issue is intermittent; no concrete steps to reproduce. One of the classes in Firestore has a grpc::CompletionQueue grpc_queue_ member variable (link). Its initialization occasionally causes a crash.

What did you expect to see?

No crash.

What did you see instead?

Intermittent crash:

Crashed: com.google.firebase.firestore
0  FirebaseFirestore              0x2ed90 grpc::GrpcLibraryCodegen::GrpcLibraryCodegen(bool) + 45 (grpc_library.h:45)
1  FirebaseFirestore              0x2ec54 grpc::CompletionQueue::CompletionQueue(grpc_completion_queue_attributes const&) + 253 (completion_queue.h:253)
2  FirebaseFirestore              0x2c954 firebase::firestore::remote::Datastore::Datastore(firebase::firestore::core::DatabaseInfo const&, std::__1::shared_ptr<firebase::firestore::util::AsyncQueue> const&, std::__1::shared_ptr<firebase::firestore::credentials::CredentialsProvider<firebase::firestore::credentials::AuthToken, firebase::firestore::credentials::User> >, std::__1::shared_ptr<firebase::firestore::credentials::CredentialsProvider<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > >, firebase::firestore::remote::ConnectivityMonitor*, firebase::firestore::remote::FirebaseMetadataProvider*) + 104 (datastore.cc:104)
3  FirebaseFirestore              0x63204 firebase::firestore::core::FirestoreClient::Initialize(firebase::firestore::credentials::User const&, firebase::firestore::api::Settings const&) + 958 (shared_ptr.h:958)
4  FirebaseFirestore              0x844c firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&) + 997 (atomic:997)
5  FirebaseFirestore              0x133414 firebase::firestore::util::Task::ExecuteAndRelease() + 491 (function.h:491)
6  libdispatch.dylib              0x481c _dispatch_client_callout + 20
7  libdispatch.dylib              0xc004 _dispatch_lane_serial_drain + 620
8  libdispatch.dylib              0xcc00 _dispatch_lane_invoke + 404
9  libdispatch.dylib              0x174bc _dispatch_workloop_worker_thread + 764
10 libsystem_pthread.dylib        0x37a4 _pthread_wqthread + 276
11 libsystem_pthread.dylib        0xa74c start_wqthread + 8

Anything else we should know about your project / environment?

I am from the Firestore team and am investigating this crash that was reported by a customer against Firestore. Full details are available at https://github.com/firebase/firebase-ios-sdk/issues/9462. I can’t see anything wrong with the code. This looks like a bug of some sort in grpc. Any thoughts would be greatly appreciated. Thank you!

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (14 by maintainers)

Most upvoted comments

@gyulavoros Firestore is unable to upgrade its grpc version due to supporting C++11. The latest grpc versions require a minimum of C++14. Firestore plans to drop C++11 support later this year (no firm date has been announced yet though) at which point it will upgrade its grpc dependency and this issue should go away.

Until then you can try the hacky workaround documented at https://github.com/firebase/firebase-ios-sdk/issues/9462#issuecomment-1341250988. So far one customer has reported that the workaround fixes their crash: https://github.com/firebase/firebase-ios-sdk/issues/10622#issuecomment-1372299314.