Skip to content
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

Firestore client stops functioning after 100 snapshot listeners are registered #3514

Closed
nikammerlaan opened this issue Jul 28, 2018 · 3 comments
Assignees
Labels
api: firestore Issues related to the Firestore API. type: question Request for information or clarification. Not an issue.

Comments

@nikammerlaan
Copy link

nikammerlaan commented Jul 28, 2018

I've run into an issue with my application where all requests (get/set/update/queries) and listeners stop functioning after the 100th one is added (the first 100 listeners still function, all ones added after just sit idle and never receive any events). If I had to guess what could be causing the issue, I'd guess that there is probably a saturated threadpool somewhere. I tried to look around in the source for that but I couldn't find what I was looking for.

Edit: After doing some more investigating, it seems that all requests (get, set, update, query, etc)block after that 100th listener is added.

@nikammerlaan nikammerlaan changed the title Firestore stops functioning after 100 snapshot listeners are registered Firestore client stops functioning after 100 snapshot listeners are registered Jul 28, 2018
@JustinBeckwith JustinBeckwith added the triage me I really want to be triaged. label Jul 29, 2018
@yihanzhen yihanzhen added type: question Request for information or clarification. Not an issue. priority: p2 Moderately-important priority. Fix may not be included in next release. api: firestore Issues related to the Firestore API. labels Jul 30, 2018
@JustinBeckwith JustinBeckwith removed the triage me I really want to be triaged. label Jul 30, 2018
@yoshi-automation yoshi-automation added the 🚨 This issue needs some love. label Jan 24, 2019
@sduskis sduskis removed 🚨 This issue needs some love. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 5, 2019
@schmidt-sebastian
Copy link
Contributor

schmidt-sebastian commented Mar 22, 2019

@nikammerlaan Thanks for reporting this issue! This is actually a limitation of our network stack. By default, we only support 100 concurrent streams. If you are hitting this limit, you can change the number of connections in the pool. To change the setting you can do the following:

Builder options =  FirestoreOptions.newBuilder().build().toBuilder();
options.setChannelProvider(
   FirestoreOptions.getDefaultTransportChannelProviderBuilder().setPoolSize(2).build());
firestore = options.build().getService();

We allow 100 streams per entry in the pool, but you can adjust this setting as needed. Note that introduces some overhead, as each connection requires its own setup.

@appsgenie
Copy link

Does this mean 100 total snapshots across all clients for the entire database or 100 from one client (either a mobile device or with admin sdk)?

@lucazin
Copy link

lucazin commented Dec 21, 2023

I have this kind of problem @schmidt-sebastian

i have 7 listeners, but always disconnecting some listeners and stop registering information in database. Im using Java.

What i have to do..to stop this behavior..?? because its intermitent situation.

I have to move to realtime database? or have some config extra to fix that? Because when i restart the server the listener back again..

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: firestore Issues related to the Firestore API. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

8 participants