-
Notifications
You must be signed in to change notification settings - Fork 909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Getting RESOURCE_EXHAUSTED randomly #7655
Comments
Note that if I'm using |
Hi @gilamran Thanks for the report. We are looking into this issue, but I want to describe what is happening: This is essentially an issue caused by slow SDK documents consumption. When a large number of documents are being returned from Firestore's backend, and the SDK is taking too long to process the incoming responses, the backend need to keep the documents in its buffer. When that buffer is fully filled, the backend has to drop the result and return a RESOURCE_EXHAUSTED error, in order for its own survival. Of all Firestore SDKs, the Web SDK is the slowest, and thus most susceptible to this issue. This explained why the error is random (sometimes it is faster enough to consume those documents); also why We will try to return a more meaningful error message to reduce confusion, at the very least. We are still investigating to see if we can improve the situation. I will post updates here when we have them. In the meantime, the best you can do is to break up your large query into smaller ones, you can use pagination, or apply additional filters. Thanks! |
Please take these points into account:
|
Thanks for more information. Was there any change on your side a week ago? Did you upgrade to a newer version of the SDK for example? This limitation always exists, but we have not eliminated the possibility that it is some change to our backend that made this worse than before. Any information that could help us isolate the likely causes is helpful. -- On CPU load, I think that is one of the likely places where SDK is struggling to consume, it could be somehow the network load is too much for example. And also this has nothing to do with if client/SDK is actually processing the documents, the SDK was simply not fast enough in receiving (and acknowledging) the documents for some reason. Having said this, it is also possible it's some backend component that is slowing responses down, we will check those too. |
I agree with @gilamran that this issue is not caused due to CPU, Memory or Network starvation on the Client (Web Browser), which is causing the delay in the processing. Whenever we encountered firebase/firebase-android-sdk#3070 we observed everything in detail. So, I am sure about this. |
We changed nothing a week ago, and did not upgrade the SDK version. |
ok, we've contacted Google, they investigated the issue, found it, fixed it, and deployed it. |
Thanks @gilamran To add more context, the R_E error limit still exists, and my comment #7655 (comment) still applies: if the client is too slow receiving responses backend might have to give up buffering and send this error to clients. However, this was not what happened with this particular report. The clients in these reports were fine, there was something going on in the backend that was causing this. Hope this would help people in the future running into this error troubleshoot. |
We experience this problem as well. It started about a month ago. There was no change in code or SDK version.
Thank you for any help! |
It's a per client limit.
It's on the number of documents for now, we could change this at sometime without announcements however.
Not sure I understand your question. It could be device-dependent because different clients consume documents at different rates. However, I just want to stress that this particular reporting is induced by a backend change, and it has now been fixed. Different client consume rate could affect how soon you will reach the limit still though. |
Thanks your for your help. It is very much appreciated.
We are getting this problem, by the way, using .onSnapshot(...) and at times (for hours or even days) the error doesn't occur at all and sometimes it occurs nearly everytime, doing the same exact thing with (basically) the same data every time. One observation that is very suspicious is the fact that every time the error occurs it basically does so immediately (clearly within one second) while when it doesn't the data loads for several seconds (it's loading data on the scale of 10k to 100k documents). There seems to be these two different kinds of scenarios and no continuum between them. That seems odd given the explanation you provided. Or can you explain that? Thank you very much! |
I am not allowed to disclose the limit unfortunately, as this is not a guarantee from Firestore, and will change over time. Are you still experiencing this now? The backend change should fixed the issue we identified. So you might be seeing a different issue, if you are still seeing it. I also do not have an explanation for what you observed. I will forward this to our backend engineers. |
Thanks! Yes, we are experiencing this. But it cannot be consistently reproduced at all. Right now I'm trying to do it with network throttling in Chrome and still I can't deliberately reproduce it. It is very weird. With "Fast 3G" it took forever to load the data. But it still worked. I was able to reproduce the error in the past without browser as well - just a node script that subscribes to two collections (with ~100k and ~10k documents data) using .onSnapshot(...) and does nothing with the data when it arrives and nothing else either. |
Operating System
macOS 13.6 (22G120)
Browser Version
Node 18 or Latest Chrome
Firebase SDK Version
10.4.0
Firebase SDK Product:
Firestore
Describe your project's tooling
nodejs or browser with firestore
Describe the problem
Using the simplest project with only one collection with 30,000 items in the collection. each doc in the collection looks like this:
{ id: 1 }
. I'm gettingRESOURCE_EXHAUSTED
randomly.The project is in Blaze!
The
projectId
is test2-82c47Steps and code to reproduce issue
The simplest example will be to just paste this code into
index.js
and runnode index.js
The error happens randomly, for me it happened around 50% of tires, so if it did not happen re-run.
This is the error that I got:
The text was updated successfully, but these errors were encountered: