firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Bug: Crash on real device Firestore

Open jesus-mg-ios opened this issue 1 year ago • 4 comments

Description

Crash on real devices in production, I couldn't reproduce on my side. All iOS devices are 17.4.1. on Mac are different versions. The trace is always the same.

Reproducing the issue

No response

Firebase SDK Version

10.25.0

Xcode Version

15.2

Installation Method

Swift Package Manager

Firebase Product(s)

Firestore

Targeted Platforms

iOS, macCatalyst

Relevant Log Output

Crashed: com.google.firebase.firestore
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
0 grpc_core::ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(grpc_core::LoadBalancingPolicy::SubchannelPicker*, absl::lts_20240116::Status*) + 44972
1 grpc_core::ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool) + 43848
2 grpc_core::ClientChannelFilter::FilterBasedLoadBalancedCall::TryPick(bool) + 51460
3 grpc_core::ClientChannelFilter::FilterBasedLoadBalancedCall::StartTransportStreamOpBatch(grpc_transport_stream_op_batch*) + 49124
4 grpc_core::ExecCtx::Flush() + 218976
5 grpc_core::ExecCtx::~ExecCtx() + 67216
6 grpc_call_start_batch + 263556
7 grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage, grpc::internal::CallOpClientSendClose, grpc::internal::CallNoOp<4>, grpc::internal::CallNoOp<5>, grpc::internal::CallNoOp<6>>::ContinueFillOpsAfterInterception() + 4384280264
8 grpc::ClientAsyncReaderWriter<grpc::ByteBuffer, grpc::ByteBuffer>::Write(grpc::ByteBuffer const&, grpc::WriteOptions, void*) + 4384273588
9 irebase::firestore::remote::GrpcStream::MaybeWrite(absl::lts_20240116::optional<firebase::firestore::remote::internal::BufferedWrite>) + 4384296780
10 firebase::firestore::remote::GrpcStream::Write(grpc::ByteBuffer&&) + 4384296520
11 firebase::firestore::remote::WatchStream::WatchQuery(firebase::firestore::local::TargetData const&) + 229092
12 firebase::firestore::remote::RemoteStore::SendWatchRequest(firebase::firestore::local::TargetData const&) + 5928
13 non-virtual thunk to firebase::firestore::remote::RemoteStore::OnWatchStreamOpen() + 6624
14 firebase::firestore::remote::Stream::OnStreamStart() + 62444
15 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&) + 62148
16 std::__1::__function::__func<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20240116::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken>> const&, absl::lts_20240116::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_20240116::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken>> const&, absl::lts_20240116::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> const&) const::'lambda'()>, void ()>::operator()() + 68080
17 firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&) + 4383729480
18 firebase::firestore::util::Task::ExecuteAndRelease() + 141208
19 libdispatch.dylib
_dispatch_client_callout + 20

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

Expand Package.resolved snippet

Replace this line with the contents of your Package.resolved.

If using CocoaPods, the project's Podfile.lock

Expand Podfile.lock snippet

Replace this line with the contents of your Podfile.lock!

jesus-mg-ios avatar May 15 '24 07:05 jesus-mg-ios

Can you tell us how often this happens?

wu-hui avatar May 16 '24 15:05 wu-hui

I received a few crashes like 2-3 a day. Any ideas about why this is happening? @wu-hui

jesus-mg-ios avatar May 16 '24 17:05 jesus-mg-ios

This looks like a memory corruption issue from grpc, our dependency. I do not have insights on the likely causes at this point unfortunately. I will ask our grpc team to see if they have some ideas.

wu-hui avatar May 21 '24 16:05 wu-hui

+1

Firebase FirestoreInternal 11.4.0 gRPC-Core 1.65.0

Exclusively iPhone, mixed foreground/background states, independent of OS version.

Crashed: com.google.firebase.firestore
EXC_BAD_ACCESS KERN_INVALID_ADDRESS 0x0000000000000000
          Crashed: com.google.firebase.firestore
0  grpc                           0xaefcc grpc_core::ClientChannelFilter::LoadBalancedCall::PickSubchannelImpl(grpc_core::LoadBalancingPolicy::SubchannelPicker*, absl::lts_20240116::Status*) + 2961 (client_channel_filter.cc:2961)
1  grpc                           0xaeb58 grpc_core::ClientChannelFilter::LoadBalancedCall::PickSubchannel(bool) + 2908 (client_channel_filter.cc:2908)
2  grpc                           0xb08ec grpc_core::ClientChannelFilter::FilterBasedLoadBalancedCall::TryPick(bool) + 463 (optional.h:463)
3  grpc                           0xafff8 grpc_core::ClientChannelFilter::FilterBasedLoadBalancedCall::StartTransportStreamOpBatch(grpc_transport_stream_op_batch*) + 3306 (client_channel_filter.cc:3306)
4  grpc                           0x1126cc grpc_core::ExecCtx::Flush() + 814 (status.h:814)
5  grpc                           0x10858 grpc_core::ExecCtx::~ExecCtx() + 131 (exec_ctx.h:131)
6  grpc                           0x36454 grpc_call_start_batch + 302 (exec_ctx.h:302)
7  FirebaseFirestoreInternal      0x8fa70 grpc::internal::CallOpSet<grpc::internal::CallOpSendInitialMetadata, grpc::internal::CallOpSendMessage, grpc::internal::CallOpClientSendClose, grpc::internal::CallNoOp<4>, grpc::internal::CallNoOp<5>, grpc::internal::CallNoOp<6>>::ContinueFillOpsAfterInterception() + 971 (call_op_set.h:971)
8  FirebaseFirestoreInternal      0x8dff0 grpc::ClientAsyncReaderWriter<grpc::ByteBuffer, grpc::ByteBuffer>::Write(grpc::ByteBuffer const&, grpc::WriteOptions, void*) + 578 (async_stream.h:578)
9  FirebaseFirestoreInternal      0x93a00 firebase::firestore::remote::GrpcStream::MaybeWrite(absl::lts_20240116::optional<firebase::firestore::remote::internal::BufferedWrite>) + 647 (shared_ptr.h:647)
10 FirebaseFirestoreInternal      0x938fc firebase::firestore::remote::GrpcStream::Write(grpc::ByteBuffer&&) + 65 (optional.h:65)
11 FirebaseFirestoreInternal      0x154404 firebase::firestore::remote::WatchStream::WatchQuery(firebase::firestore::local::TargetData const&) + 97 (byte_buffer.h:97)
12 FirebaseFirestoreInternal      0x11b31c firebase::firestore::remote::RemoteStore::SendWatchRequest(firebase::firestore::local::TargetData const&) + 60 (target_data.h:60)
13 FirebaseFirestoreInternal      0x11b528 non-virtual thunk to firebase::firestore::remote::RemoteStore::OnWatchStreamOpen() + 237 (remote_store.cc:237)
14 FirebaseFirestoreInternal      0x12b304 firebase::firestore::remote::Stream::OnStreamStart() + 724 (shared_ptr.h:724)
15 FirebaseFirestoreInternal      0x12b258 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&) + 182 (stream.cc:182)
16 FirebaseFirestoreInternal      0x12c898 std::__1::__function::__func<firebase::firestore::remote::Stream::RequestCredentials()::$_0::operator()(absl::lts_20240116::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken>> const&, absl::lts_20240116::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_20240116::optional<firebase::firestore::util::StatusOr<firebase::firestore::credentials::AuthToken>> const&, absl::lts_20240116::optional<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>> const&) const::'lambda'()>, void ()>::operator()() + 156 (shared_ptr.h:156)
17 FirebaseFirestoreInternal      0x785c firebase::firestore::util::AsyncQueue::ExecuteBlocking(std::__1::function<void ()> const&) + 336 (cxx_atomic_impl.h:336)
18 FirebaseFirestoreInternal      0x13d11c firebase::firestore::util::Task::ExecuteAndRelease() + 188 (task.cc:188)
19 libdispatch.dylib              0x3fa8 _dispatch_client_callout + 20
20 libdispatch.dylib              0xb5cc _dispatch_lane_serial_drain + 768
21 libdispatch.dylib              0xc124 _dispatch_lane_invoke + 380
22 libdispatch.dylib              0x1738c _dispatch_root_queue_drain_deferred_wlh + 288
23 libdispatch.dylib              0x16bd8 _dispatch_workloop_worker_thread + 540
24 libsystem_pthread.dylib        0x3680 _pthread_wqthread + 288
25 libsystem_pthread.dylib        0x1474 start_wqthread + 8

importRyan avatar Jan 03 '25 18:01 importRyan