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

[cloud_firestore]: TooManyRequestsException #13548

Open
1 task done
ricardobegar opened this issue Oct 23, 2024 · 5 comments
Open
1 task done

[cloud_firestore]: TooManyRequestsException #13548

ricardobegar opened this issue Oct 23, 2024 · 5 comments
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. blocked: firebase-sdk platform: android Issues / PRs which are specifically for Android. plugin: cloud_firestore Stale Issue with no recent activity type: bug Something isn't working

Comments

@ricardobegar
Copy link

ricardobegar commented Oct 23, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Other

Which platforms are affected?

Android

Description

Randomly when I consult data from Firestore it gives me the error TooManyRequestsException

Reproducing the issue

Just initialize the project. The error is random, sometimes yes, sometimes no.

Firebase Core version

3.6.0

Flutter Version

3.24.3

Relevant Log Output

Screenshot 2024-10-22 at 2 12 59 PM

Flutter dependencies

Expand Flutter dependencies snippet
dependencies:
- cloud_firestore 5.4.4 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 3.6.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine]

dev dependencies:
- flutter_test 0.0.0 [flutter test_api matcher path fake_async clock stack_trace vector_math leak_tracker_flutter_testing async boolean_selector characters collection leak_tracker leak_tracker_testing material_color_utilities meta source_span stream_channel string_scanner term_glyph vm_service]
- integration_test 0.0.0 [flutter flutter_driver flutter_test path vm_service async boolean_selector characters clock collection fake_async file leak_tracker leak_tracker_flutter_testing leak_tracker_testing matcher material_color_utilities meta source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api vector_math webdriver]
- jarvis_lint 1.4.1

dependency overrides:
- jarvis_lint 1.4.1

transitive dependencies:
- _flutterfire_internals 1.3.44 [collection firebase_core firebase_core_platform_interface flutter meta]
- async 2.11.0 [collection meta]
- boolean_selector 2.1.1 [source_span string_scanner]
- characters 1.3.0
- clock 1.1.1
- cloud_firestore_platform_interface 6.4.3 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface]
- cloud_firestore_web 4.3.2 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins]
- collection 1.18.0
- fake_async 1.3.1 [clock collection]
- file 7.0.0 [meta path]
- firebase_core_platform_interface 5.3.0 [collection flutter flutter_test meta plugin_platform_interface]
- firebase_core_web 2.18.1 [firebase_core_platform_interface flutter flutter_web_plugins meta web]
- flutter_driver 0.0.0 [file flutter flutter_test fuchsia_remote_debug_protocol path meta vm_service webdriver async boolean_selector characters clock collection leak_tracker leak_tracker_flutter_testing leak_tracker_testing matcher material_color_utilities platform process source_span stack_trace stream_channel string_scanner sync_http term_glyph test_api vector_math]
- flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math]
- fuchsia_remote_debug_protocol 0.0.0 [process vm_service file meta path platform]
- leak_tracker 10.0.5 [clock collection meta path vm_service]
- leak_tracker_flutter_testing 3.0.5 [flutter leak_tracker leak_tracker_testing matcher meta]
- leak_tracker_testing 3.0.1 [leak_tracker matcher meta]
- matcher 0.12.16+1 [async meta stack_trace term_glyph test_api]
- material_color_utilities 0.11.1 [collection]
- meta 1.15.0
- path 1.9.0
- platform 3.1.5
- plugin_platform_interface 2.1.8 [meta]
- process 5.0.2 [file path platform]
- sky_engine 0.0.99
- source_span 1.10.0 [collection path term_glyph]
- stack_trace 1.11.1 [path]
- stream_channel 2.1.2 [async]
- string_scanner 1.2.0 [source_span]
- sync_http 0.3.1
- term_glyph 1.2.1
- test_api 0.7.2 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph]
- vector_math 2.1.4
- vm_service 14.2.5
- web 1.1.0
- webdriver 3.0.3 [matcher path stack_trace sync_http]

Additional context and comments

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  FirebaseOptions options = FirebaseOptions(
    apiKey: '',
    appId: '',
    messagingSenderId: '354026033970',
    projectId: 'example.firebase_error',
  );

  await Firebase.initializeApp(
    options: options,
  );

  CollectionReference<Map<String, dynamic>> _collection =
      FirebaseFirestore.instance.collection('url_config');
  DocumentReference<Map<String, dynamic>> _doc =
      _collection.doc('kzgDz9DQfUwmXK7dhApc');
  DocumentSnapshot<Map<String, dynamic>> _get = await _doc.get();
  Map<String, dynamic>? data = _get.data();

  runApp(const MyWidget());
}

class MyWidget extends StatefulWidget {
  const MyWidget({super.key});

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
        body: Text('Hola soy goky'),
      ),
    );
  }
}
@ricardobegar ricardobegar added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Oct 23, 2024
@SelaseKay
Copy link
Contributor

Hi @ricardobegar, this appears to be a native sdk issue. You can keep tracks on it here: firebase/firebase-android-sdk#6365.

@SelaseKay SelaseKay added blocked: firebase-sdk plugin: cloud_firestore platform: android Issues / PRs which are specifically for Android. and removed Needs Attention This issue needs maintainer attention. labels Oct 24, 2024
@ricardobegar
Copy link
Author

thank you very much for responding. I'm going to follow up on that thread. If you know anything, I would appreciate it if you could let me know.

@MarkDuckworth
Copy link

@SelaseKay,

I work on the native Android Firebase SDK and I was able to identify a cause of the exception: android.net.ConnectivityManager$TooManyRequestsException.

However the code related to the Android Firebase SDK appears to be unchanged and behaving as expected. Specifically the error occurs due to resource exhaustion when creating more than 100 FirebaseFirestore instances without terminating any of them, using firestore.terminate().

We have 10 reports of this issue in the last 3 weeks, and many indicate that they started seeing this issue with a Flutter upgrade. This suggests to me that there may be a change in Flutter or FlutterFire that is causing these apps to leak FirebaseFirestore instances.

Can you confirm if there is any recent change to Flutter or FlutterFire that may be causing FlutterFire to create many instances of FirebaseFirestore without terminating them?

@Lyokone
Copy link
Contributor

Lyokone commented Oct 31, 2024

Thanks for giving more context @MarkDuckworth, I'll have a look to see if I can see any recent change that could cause that

EDIT: Nothing in the code caching the Firebase Firestore instance on Android has changed in 14 months. I think it's probably caused by the latest firebase_core / cloud_firestore versions because they include the latest version of Native SDKs. But let me investigate a bit more to see if I can reproduce it locally.

@Lyokone Lyokone changed the title [cloude_firestore]: TooManyRequestsException [cloud_firestore]: TooManyRequestsException Oct 31, 2024
@Lyokone Lyokone added the blocked: customer-response Waiting for customer response, e.g. more information was requested. label Nov 7, 2024
@google-oss-bot
Copy link

Hey @ricardobegar. We need more information to resolve this issue but there hasn't been an update in 7 weekdays. I'm marking the issue as stale and if there are no new updates in the next 7 days I will close it automatically.

If you have more information that will help us get to the bottom of this, just add a comment!

@google-oss-bot google-oss-bot added the Stale Issue with no recent activity label Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked: customer-response Waiting for customer response, e.g. more information was requested. blocked: firebase-sdk platform: android Issues / PRs which are specifically for Android. plugin: cloud_firestore Stale Issue with no recent activity type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants