firebase / flutterfire

🔥 A collection of Firebase plugins for Flutter apps.
https://firebase.google.com/docs/flutter/setup
BSD 3-Clause "New" or "Revised" License
8.67k stars 3.97k forks source link

[firebase_database]: Slow write/read operations (3-4 mins) for simple operations, not happening with Swift #13487

Open innerblooming opened 6 days ago

innerblooming commented 6 days ago

Is there an existing issue for this?

Which plugins are affected?

Database

Which platforms are affected?

Android

Description

I am using Realtime DB to write and read data from my Flutter app. Whenever I try to write some data to RTDB, the request is successful but it takes several minutes to finish it. The data has very short length and I am using some mock test values for now. After these minutes I get the breakpoint call on my .then() closure and I see the data on my Realtime DB.
I am experiencing the same delay for read operations. I am experiencing this in the simulator. When trying it on a real old device (Samsung S8), the closure completion is never reached, but I neither get an error.

The same RTDB is being used without any delay from iOS app built in Xcode+Swift.

Reproducing the issue

class RealtimeDatabaseClient {

  final publicGamesRef = FirebaseDatabase.instanceFor(
      app: Firebase.app('name'),
      databaseURL: "database-url"
  ).ref("test");

Future<void> createGame(
    int timestamp,
  ) async {
  await publicGamesRef.child(gameID).set({
    "timestamp": timestamp,
  }).then((_) {
    print("Data saved");
  }).catchError((error) {
    print("Realtime DB error");
  });
}

Firebase Core version

3.6.0

Flutter Version

3.24.1

Relevant Log Output

No response

Flutter dependencies

Expand Flutter dependencies snippet
```yaml - _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 - collection 1.18.0 - fake_async 1.3.1 [clock collection] - firebase_analytics_platform_interface 4.2.5 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_analytics_web 0.5.10+2 [_flutterfire_internals firebase_analytics_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins] - 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] - firebase_database_platform_interface 0.2.5+44 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_database_web 0.2.6+2 [collection firebase_core firebase_core_web firebase_database_platform_interface flutter flutter_web_plugins] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - 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] - lints 4.0.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.11.1 [collection] - meta 1.15.0 - nested 1.0.0 [flutter] - path 1.9.0 - plugin_platform_interface 2.1.8 [meta] - 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] - 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 ```

Additional context and comments

No response

SelaseKay commented 2 days ago

Hi @innerblooming , I'm unable to reproduce this issue. Kindly provide a full sample code reproducing this issue? Also, have you tried testing on other Android devices?