firebase / firebase/firebase-ios-sdk

Firestore.terminate hangs, and never calls callback

Open
#12,522 28 comments 2 reactions 0 assignees View on GitHub
api: firestore
Dominant language
C++
Stars
6.7k
Forks
1.8k
Avg merge
2d 14h
Merged PRs (30d)
72

Description

### Description

There are certain scenarios where I'll call Firestore's terminate function, and it will hang, never calling the callback. I haven't been able to create a reproducer, but can consistently get my product's code to get into this state (not shareable for obvious reasons).

This appears to happen when there's an overload of firestore document changes. I am able to see that the `com.google.firebase.firestore` queue's target queue is `com.apple.root.default-qos.overcommit` though not sure what this means. It looks like the queue starts with this value set as the target queue, could be a red herring.

Here's a screenshot of the backtrace of where firestore hangs... It looks like it's unable to close the gRPC watch stream for the RemoteStore, stuck on WaitUntilOffQueue.

Screenshot 2024-03-11 at 8 58 25 PM

I'm basically stuck trying to debug this to see where things go wrong and what I can do to avoid this. I'm very unfamiliar with this codebase, so I don't even know what to look for to find where the code is getting stuck. Any help with pointers on where to look or what to check would be very appreciated.

### Reproducing the issue

Can't share reproduction steps, as I can't share the relevant code.

### Firebase SDK Version

10.22

### Xcode Version

15.3

### Installation Method

CocoaPods

### Firebase Product(s)

Firestore

### Targeted Platforms

iOS

### Relevant Log Output

```shell
There are no relevant logs.
```

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

None

### If using CocoaPods, the project's Podfile.lock

Can't share

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.