question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firestore .get .(addOnCompleteListener) not receiveing response in firestore sdk 21.4.3 or newer

See original GitHub issue
  • Android Studio version: 4.1.1
  • Firebase Component: Firestore
  • Component version: 21.4.3 or higher

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I’m having issue with firestore Android sdk. We were using firestore sdk 22.0.0 but we found an issue with our application, that in some cases, data wouldn’t load successfully. After investigation, we figured out that the issue was happening when user had closed application and when there was big number of changes happening, first try to load the data was not successful. If you closed and opened application again (called .addOnCompleteListener again) the data was loaded ok, so the issue is only when you call listener for the first time since there were a lot of changes made to the documents. The strange thing is that in this .get() none of the listeners got a response (neither addOnCompleteListener, addOnFailureListener or addOnCanceledListener). I tried to wait for hours (8 documents in this collection collection, but in other collections there were hundreds of changes if not thousands).

private fun getAssignmentConsumptions() { Log.d("firestoreService", "firestoreService: getAssignmentConsumptions, started") getFacilityDocumentRef(facilityId).collection(AssignmentConsumption.COLLECTION).get().addOnCompleteListener { snapshots -> assignmentConsumptionsList = snapshots.result?.documents?.toModels<AssignmentConsumption>()?.toMutableList() ?: mutableListOf() Log.d("firestoreService", "firestoreService: getAssignmentConsumptions, done") assignmentConsumptionsListBehaviourRelay.accept(assignmentConsumptionsList.toList()) }.addOnFailureListener { Log.d("firestoreService", "firestoreService: getAssignmentConsumptions, onFailure") }.addOnCanceledListener { Log.d("firestoreService", "firestoreService: getAssignmentConsumptions, onCanceled") } }

Then I tried to use firestore 19.0.0 version. And it worked as it should. Then I decided that I would figure out when was this “issue” introduced into firestore project. The last version that works OK for us is the 21.4.2 version, anything above this version, this .get() call gets 0 response.

In documentation for version 21.4.3 it says this:

Cloud Firestore version 21.4.3 Cloud Firestore now limits the number of concurrent document lookups it will perform when resolving inconsistencies in the local cache.

As we can see there were some changes done for local cache, but it seems that this broke loading/resolving local data with new changes, where we don’t get response about what is happening.

I cannot make a sample where this is reproduceable , but in our case it’s reproduceable 100% of the time. To reproduce this, we delete all collections and documents of this data set and populate it with the same again (our backend does this). First loading is not successful, the second one is. And this issue only occurs from version 21.4.2 onwards.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:37 (24 by maintainers)

github_iconTop GitHub Comments

2reactions
dconeybecommented, Feb 5, 2021

Update: This fix did not get merged in time for the next release, but will be part of the release following the next release, which is expected (but not guaranteed!) to be near the end of this month (Feb 2021).

1reaction
dconeybecommented, Jan 28, 2021

Update: I’ve finally gotten myself to the point where I am also experiencing the java.lang.RuntimeException: Internal error in Cloud Firestore (22.0.2). error due to java.lang.NoClassDefFoundError: Failed resolution of: Lio/grpc/protobuf/lite/ProtoLiteUtils;. I think I may just need to go through a few rounds of explicitly including dependencies that are automatically pulled in when using the non-snapshot version of Firestore. I’ll reply back once I know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Firebase Android SDK Release Notes - Google
Learn how to install these SDKs in your app: Add Firebase to your Android ... issue that caused Cloud Firestore listeners to stop...
Read more >
AddonCompleteListener for firestore not triggered
I want to get a field value form the firestore and the addonComplete listener is not triggering. So want to know why this...
Read more >
how to load image with the help firestore reference path in ...
Step 6: Add that image URL to the Realtime database. Go to the Realtime database option then click on the create database button....
Read more >
Firestore android sdk - Weebly
SDK no longer need a fire base in firebase Android Firebase-core library. ... Firestore 21.4.3 Cloud Firestore now limits the number of close...
Read more >
I-Solution – putting out content which is hard to find
then using the cowin api we will get the information related to slots . ... implementation 'com.google.firebase:firebase-firestore-ktx:21.4.3'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found