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.73k stars 3.98k forks source link

[CLOUD_FIRESTORE]: Windows app crashes while tying to get a document #12987

Open ciceromsjr opened 5 months ago

ciceromsjr commented 5 months ago

Is there an existing issue for this?

Which plugins are affected?

Database

Which platforms are affected?

Windows

Description

Flutter app using cloud_firestore crashes on some machines when it try to get a document.

After the user sign in, the app try to get his information on a collection.

The app crashes on this get operation.

On Android Studio, we see only "Lost connection with the device".

However, opening on Visual Studio 2022 and running the project, it was possible to see what happens just before the app crash:

ERROR: FIRESTORE INTERNAL ASSERTION FAILED: D:\a\firebase-cpp-sdk\firebase-cpp-sdk\out-sdk\external\src\firestore\Firestore\core\src\core\firestore_client.cc(217) void __cdecl firebase::firestore::core::FirestoreClient::Initialize(const class firebase::firestore::credentials::User &,const class firebase::firestore::api::Settings &): Failed to open DB: Internal: Failed to open LevelDB database at C:\Users\cicer\AppData\Local\firestore\[DEFAULT]\myapp\main: LevelDB error: Corruption: CURRENT points to a non-existent file: NotFound: C:\Users\cicer\AppData\Local\firestore\[DEFAULT]\myapp\main/MANIFEST-000009: The file system cannot find the file specified. (expected created.ok())

And also this one:

Unhandled exception at 0x00007FFE588DCF19 in myapp.exe: Microsoft C++ exception: firebase::firestore::FirestoreInternalError at memory location 0x000000327B9FF0A0.

It seems the local persistence is failing.

I don't know if it matters, but I don't have this "D:" disk on the machine as well:

"D:\a\firebase-cpp-sdk\firebase-cpp-sdk..."

Reproducing the issue

I really do not know how to reproduce it. It happens on some machines only.

However, I hope the log helps to understand what is going on with this operation on Windows.

Firebase Core version

3.1.0

Flutter Version

3.22.2

Relevant Log Output


ERROR: FIRESTORE INTERNAL ASSERTION FAILED: D:\a\firebase-cpp-sdk\firebase-cpp-sdk\out-sdk\external\src\firestore\Firestore\core\src\core\firestore_client.cc(217) void __cdecl firebase::firestore::core::FirestoreClient::Initialize(const class firebase::firestore::credentials::User &,const class firebase::firestore::api::Settings &): Failed to open DB: Internal: Failed to open LevelDB database at C:\Users\cicer\AppData\Local\firestore\[DEFAULT]\myapp\main: LevelDB error: Corruption: CURRENT points to a non-existent file: NotFound: C:\Users\cicer\AppData\Local\firestore\[DEFAULT]\myapp\main/MANIFEST-000009: The file system cannot find the file specified. (expected created.ok())

Unhandled exception at 0x00007FFE588DCF19 in myapp.exe: Microsoft C++ exception: firebase::firestore::FirestoreInternalError at memory location 0x000000327B9FF0A0.

Flutter dependencies

Expand Flutter dependencies snippet
```yaml Dart SDK 3.4.3 Flutter SDK 3.22.2 minhasfinancas 1.2406.114+114 dependencies: - app_tracking_transparency 2.0.4 [flutter] - archive 3.4.10 [crypto path pointycastle] - background_downloader 8.4.3 [flutter logging http path_provider path async mime collection] - cached_network_image 3.3.1 [cached_network_image_platform_interface cached_network_image_web flutter flutter_cache_manager octo_image] - cloud_firestore 5.0.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta] - collection 1.18.0 - community_material_icon 5.9.55 [flutter] - connectivity_checker 1.1.0 [flutter provider] - crypto 3.0.3 [typed_data] - csv 5.1.1 - cupertino_http 1.5.0 [async ffi flutter http http_profile web_socket] - cupertino_icons 1.0.6 - currency_picker 2.0.21 [flutter collection] - d_chart 2.6.9 [flutter community_charts_flutter community_charts_common] - data_table_2 2.5.12 [flutter async] - device_info_plus 10.1.0 [device_info_plus_platform_interface ffi file flutter flutter_web_plugins meta web win32 win32_registry] - dotted_line 3.2.2 [flutter] - dropdown_button2 2.3.9 [flutter meta] - encrypt 5.0.3 [args asn1lib clock collection crypto pointycastle] - event_bus 2.0.0 - excel 2.1.0 [archive xml collection equatable] - expansion_widget 0.0.3 [flutter] - extension_google_sign_in_as_googleapis_auth 2.0.12 [flutter google_sign_in googleapis_auth http meta] - fancy_password_field 2.0.6 [flutter password_strength] - file_picker 6.2.1 [flutter flutter_web_plugins flutter_plugin_android_lifecycle plugin_platform_interface ffi path win32] - firebase_auth 5.1.0 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta] - firebase_core 3.1.0 [firebase_core_platform_interface firebase_core_web flutter meta] - firebase_crashlytics 4.0.1 [firebase_core firebase_core_platform_interface firebase_crashlytics_platform_interface flutter stack_trace] - firebase_dart 1.1.4 [quiver async logging sortedmap web_socket_channel stream_channel collection meta jose clock firebaseapis openid_client hive rxdart http _discoveryapis_commons expressions uuid crypto js synchronized intl] - firebase_messaging 15.0.1 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta] - firebase_storage 12.0.1 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter] - firedart 0.9.8 [http grpc protobuf fixnum] - fl_chart 0.67.0 [equatable flutter] - flutter 0.0.0 [characters collection material_color_utilities meta vector_math sky_engine] - flutter_email_sender 6.0.3 [flutter] - flutter_grid_button 2.1.0 [flutter] - flutter_local_notifications 16.3.3 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone] - flutter_localizations 0.0.0 [flutter intl characters clock collection material_color_utilities meta path vector_math] - flutter_secure_storage 9.2.2 [flutter flutter_secure_storage_linux flutter_secure_storage_macos flutter_secure_storage_platform_interface flutter_secure_storage_web flutter_secure_storage_windows meta] - flutter_simple_calculator 2.2.5 [flutter intl flutter_grid_button auto_size_text expressions] - flutter_social_textfield 0.1.2 [flutter] - flutter_styled_toast 2.2.1 [flutter flutter_localizations] - flutter_svg 2.0.10+1 [flutter http vector_graphics vector_graphics_codec vector_graphics_compiler] - flutter_timezone 1.0.8 [flutter_web_plugins flutter js] - get 4.6.6 [flutter] - google_mobile_ads 5.0.0 [meta flutter webview_flutter_android webview_flutter_wkwebview webview_flutter] - http 1.2.1 [async http_parser meta web] - image_cropper 5.0.1 [flutter image_cropper_platform_interface image_cropper_for_web] - image_picker 1.0.7 [flutter image_picker_android image_picker_for_web image_picker_ios image_picker_linux image_picker_macos image_picker_platform_interface image_picker_windows] - in_app_purchase 3.2.0 [flutter in_app_purchase_android in_app_purchase_platform_interface in_app_purchase_storekit] - in_app_review 2.0.9 [flutter in_app_review_platform_interface] - intl 0.19.0 [clock meta path] - json_annotation 4.8.1 [meta] - just_the_tooltip 0.0.12 [flutter] - local_auth 2.2.0 [flutter local_auth_android local_auth_darwin local_auth_platform_interface local_auth_windows] - lottie 3.1.0 [archive flutter http path vector_math] - mask_text_input_formatter 2.9.0 [flutter] - mime 1.0.5 - modal_bottom_sheet 2.1.2 [flutter] - ntp 2.0.0 - open_app_file 4.0.2 [flutter ffi] - package_info_plus 6.0.0 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface web win32] - path 1.9.0 - path_provider 2.1.2 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows] - pdf 3.10.8 [archive barcode bidi crypto image meta path_parsing vector_math xml] - percent_indicator 4.2.3 [flutter] - persistent_bottom_nav_bar_v2 5.2.3 [flutter go_router] - progress_dialog_null_safe 1.0.7 [flutter] - provider 6.1.2 [collection flutter nested] - r_logger 0.3.0 [flutter intl] - release_notes_dialog 2.0.0 [flutter] - retry 3.1.2 - share_plus 9.0.0 [cross_file meta mime flutter flutter_web_plugins share_plus_platform_interface file url_launcher_web url_launcher_windows url_launcher_linux url_launcher_platform_interface ffi web win32] - shared_preferences 2.2.3 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows] - shimmer 2.0.0 [flutter] - sprintf 7.0.0 - sqflite 2.3.3+1 [flutter sqflite_common path] - sqflite_common_ffi 2.3.3 [sqlite3 sqflite_common synchronized path meta] - sqlite3_flutter_libs 0.5.23 [flutter] - sticky_headers 0.3.0+2 [flutter] - synchronized 3.1.0+1 - tab_indicator_styler 2.0.0 [flutter] - timezone 0.9.2 [path] - tutorial 1.0.9 [flutter] - universal_disk_space 0.2.3 [universal_io] - url_launcher 6.2.5 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows] - uuid 4.4.0 [crypto sprintf meta fixnum] - window_manager 0.3.8 [flutter path screen_retriever] dev dependencies: - build_runner 2.4.8 [analyzer args async build build_config build_daemon build_resolvers build_runner_core code_builder collection crypto dart_style frontend_server_client glob graphs http_multi_server io js logging meta mime package_config path pool pub_semver pubspec_parse shelf shelf_web_socket stack_trace stream_transform timing watcher web_socket_channel yaml] - flutter_lints 3.0.1 [lints] - json_serializable 6.7.1 [analyzer async build build_config collection json_annotation meta path pub_semver pubspec_parse source_gen source_helper] - msix 3.16.7 [args yaml path package_config get_it image pub_semver console cli_util] dependency overrides: - intl 0.19.0 [clock meta path] transitive dependencies: - _discoveryapis_commons 1.0.6 [http http_parser meta] - _fe_analyzer_shared 67.0.0 [meta] - _flutterfire_internals 1.3.37 [collection firebase_core firebase_core_platform_interface flutter meta] - analyzer 6.4.1 [_fe_analyzer_shared collection convert crypto glob meta package_config path pub_semver source_span watcher yaml] - args 2.4.2 - asn1lib 1.5.2 - async 2.11.0 [collection meta] - auto_size_text 3.0.0 [flutter] - barcode 2.2.6 [meta qr] - bidi 2.0.10 - boolean_selector 2.1.1 [source_span string_scanner] - build 2.4.1 [analyzer async convert crypto glob logging meta package_config path] - build_config 1.1.1 [checked_yaml json_annotation path pubspec_parse yaml] - build_daemon 4.0.1 [built_collection built_value crypto http_multi_server logging path pool shelf shelf_web_socket stream_transform watcher web_socket_channel] - build_resolvers 2.4.2 [analyzer async build collection convert crypto graphs logging package_config path pool pub_semver stream_transform yaml] - build_runner_core 7.3.0 [async build build_config build_resolvers collection convert crypto glob graphs json_annotation logging meta package_config path pool timing watcher yaml] - built_collection 5.1.1 - built_value 8.9.1 [built_collection collection fixnum meta] - cached_network_image_platform_interface 4.0.0 [flutter flutter_cache_manager] - cached_network_image_web 1.1.1 [cached_network_image_platform_interface flutter flutter_cache_manager] - characters 1.3.0 - checked_yaml 2.0.3 [json_annotation source_span yaml] - cli_util 0.4.1 [meta path] - clock 1.1.1 - cloud_firestore_platform_interface 6.2.7 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - cloud_firestore_web 4.0.1 [_flutterfire_internals cloud_firestore_platform_interface collection firebase_core firebase_core_web flutter flutter_web_plugins] - code_builder 4.10.0 [built_collection built_value collection matcher meta] - community_charts_common 1.0.4 [intl collection meta vector_math] - community_charts_flutter 1.0.2 [collection meta community_charts_common flutter] - console 4.1.0 [vector_math] - convert 3.1.1 [typed_data] - cross_file 0.3.4+1 [meta web] - crypto_keys 0.3.0+1 [pointycastle meta collection quiver] - dart_style 2.3.6 [analyzer args collection path pub_semver source_span] - dbus 0.7.10 [args ffi meta xml] - device_info_plus_platform_interface 7.0.0 [flutter meta plugin_platform_interface] - equatable 2.0.5 [collection meta] - expressions 0.2.5+1 [quiver petitparser rxdart meta] - fake_async 1.3.1 [clock collection] - ffi 2.1.2 - file 7.0.0 [meta path] - file_selector_linux 0.9.2+1 [cross_file file_selector_platform_interface flutter] - file_selector_macos 0.9.3+3 [cross_file file_selector_platform_interface flutter] - file_selector_platform_interface 2.6.2 [cross_file flutter http plugin_platform_interface] - file_selector_windows 0.9.3+1 [cross_file file_selector_platform_interface flutter] - firebase_auth_platform_interface 7.4.0 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_auth_web 5.12.2 [firebase_auth_platform_interface firebase_core firebase_core_web flutter flutter_web_plugins http_parser meta web] - firebase_core_platform_interface 5.1.0 [collection flutter flutter_test meta plugin_platform_interface] - firebase_core_web 2.17.2 [firebase_core_platform_interface flutter flutter_web_plugins meta web] - firebase_crashlytics_platform_interface 3.6.37 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_messaging_platform_interface 4.5.39 [_flutterfire_internals firebase_core flutter meta plugin_platform_interface] - firebase_messaging_web 3.8.9 [_flutterfire_internals firebase_core firebase_core_web firebase_messaging_platform_interface flutter flutter_web_plugins meta web] - firebase_storage_platform_interface 5.1.24 [_flutterfire_internals collection firebase_core flutter meta plugin_platform_interface] - firebase_storage_web 3.9.9 [_flutterfire_internals async firebase_core firebase_core_web firebase_storage_platform_interface flutter flutter_web_plugins http meta web] - firebaseapis 0.2.0 [_discoveryapis_commons http] - fixnum 1.1.0 - flutter_cache_manager 3.3.1 [clock collection file flutter http path path_provider rxdart sqflite uuid] - flutter_local_notifications_linux 4.0.0+1 [dbus ffi flutter flutter_local_notifications_platform_interface path xdg_directories] - flutter_local_notifications_platform_interface 7.0.0+1 [flutter plugin_platform_interface] - flutter_plugin_android_lifecycle 2.0.17 [flutter] - flutter_secure_storage_linux 1.2.1 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_macos 3.1.2 [flutter flutter_secure_storage_platform_interface] - flutter_secure_storage_platform_interface 1.1.2 [flutter plugin_platform_interface] - flutter_secure_storage_web 1.2.1 [flutter flutter_secure_storage_platform_interface flutter_web_plugins js] - flutter_secure_storage_windows 3.1.2 [ffi flutter flutter_secure_storage_platform_interface path path_provider win32] - 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] - flutter_web_plugins 0.0.0 [flutter characters collection material_color_utilities meta vector_math] - frontend_server_client 3.2.0 [async path] - get_it 7.7.0 [async collection meta] - glob 2.1.2 [async collection file path string_scanner] - go_router 13.2.5 [collection flutter flutter_web_plugins logging meta] - google_identity_services_web 0.3.1+1 [meta web] - google_sign_in 6.2.1 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web] - google_sign_in_android 6.1.22 [flutter google_sign_in_platform_interface] - google_sign_in_ios 5.7.4 [flutter google_sign_in_platform_interface] - google_sign_in_platform_interface 2.4.5 [flutter plugin_platform_interface] - google_sign_in_web 0.12.4 [flutter flutter_web_plugins google_identity_services_web google_sign_in_platform_interface http web] - googleapis_auth 1.5.1 [args crypto google_identity_services_web http http_parser] - graphs 2.3.1 [collection] - grpc 3.2.4 [archive async crypto fixnum googleapis_auth meta http http2 protobuf clock] - hive 2.2.3 [meta crypto] - http2 2.3.0 - http_multi_server 3.2.1 [async] - http_parser 4.0.2 [collection source_span string_scanner typed_data] - http_profile 0.1.0 - image 4.1.7 [archive meta xml] - image_cropper_for_web 3.0.0 [flutter flutter_web_plugins image_cropper_platform_interface js] - image_cropper_platform_interface 5.0.0 [flutter plugin_platform_interface http] - image_picker_android 0.8.9+3 [flutter flutter_plugin_android_lifecycle image_picker_platform_interface] - image_picker_for_web 3.0.3 [flutter flutter_web_plugins image_picker_platform_interface mime web] - image_picker_ios 0.8.9+2 [flutter image_picker_platform_interface] - image_picker_linux 0.2.1+1 [file_selector_linux file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_macos 0.2.1+1 [file_selector_macos file_selector_platform_interface flutter image_picker_platform_interface] - image_picker_platform_interface 2.9.4 [cross_file flutter http plugin_platform_interface] - image_picker_windows 0.2.1+1 [file_selector_platform_interface file_selector_windows flutter image_picker_platform_interface] - in_app_purchase_android 0.3.4+1 [collection flutter in_app_purchase_platform_interface json_annotation] - in_app_purchase_platform_interface 1.4.0 [flutter plugin_platform_interface] - in_app_purchase_storekit 0.3.14 [collection flutter in_app_purchase_platform_interface json_annotation] - in_app_review_platform_interface 2.0.5 [flutter url_launcher plugin_platform_interface platform] - io 1.0.4 [meta path string_scanner] - jose 0.3.4 [crypto_keys meta typed_data x509 http http_parser asn1lib collection] - js 0.6.7 [meta] - leak_tracker 10.0.4 [clock collection meta path vm_service] - leak_tracker_flutter_testing 3.0.3 [flutter leak_tracker leak_tracker_testing matcher meta] - leak_tracker_testing 3.0.1 [leak_tracker matcher meta] - lints 3.0.0 - local_auth_android 1.0.37 [flutter flutter_plugin_android_lifecycle intl local_auth_platform_interface] - local_auth_darwin 1.2.2 [flutter intl local_auth_platform_interface] - local_auth_platform_interface 1.0.10 [flutter plugin_platform_interface] - local_auth_windows 1.0.10 [flutter local_auth_platform_interface] - logging 1.2.0 - matcher 0.12.16+1 [async meta stack_trace term_glyph test_api] - material_color_utilities 0.8.0 [collection] - meta 1.12.0 - nested 1.0.0 [flutter] - octo_image 2.0.0 [flutter] - openid_client 0.4.8 [jose pointycastle http logging args meta clock] - package_config 2.1.0 [path] - package_info_plus_platform_interface 2.0.1 [flutter meta plugin_platform_interface] - password_strength 0.2.0 - path_parsing 1.0.1 [vector_math meta] - path_provider_android 2.2.2 [flutter path_provider_platform_interface] - path_provider_foundation 2.3.2 [flutter path_provider_platform_interface] - path_provider_linux 2.2.1 [ffi flutter path path_provider_platform_interface xdg_directories] - path_provider_platform_interface 2.1.2 [flutter platform plugin_platform_interface] - path_provider_windows 2.2.1 [ffi flutter path path_provider_platform_interface win32] - petitparser 6.0.2 [meta] - platform 3.1.4 - plugin_platform_interface 2.1.8 [meta] - pointycastle 3.7.4 [collection convert js] - pool 1.5.1 [async stack_trace] - protobuf 3.1.0 [collection fixnum meta] - pub_semver 2.1.4 [collection meta] - pubspec_parse 1.2.3 [checked_yaml collection json_annotation pub_semver yaml] - qr 3.0.1 [meta] - quiver 3.2.1 [matcher] - rxdart 0.27.7 - screen_retriever 0.1.9 [flutter] - share_plus_platform_interface 4.0.0 [cross_file flutter meta mime plugin_platform_interface path_provider uuid] - shared_preferences_android 2.2.1 [flutter shared_preferences_platform_interface] - shared_preferences_foundation 2.3.5 [flutter shared_preferences_platform_interface] - shared_preferences_linux 2.3.2 [file flutter path path_provider_linux path_provider_platform_interface shared_preferences_platform_interface] - shared_preferences_platform_interface 2.3.2 [flutter plugin_platform_interface] - shared_preferences_web 2.3.0 [flutter flutter_web_plugins shared_preferences_platform_interface web] - shared_preferences_windows 2.3.2 [file flutter path path_provider_platform_interface path_provider_windows shared_preferences_platform_interface] - shelf 1.4.1 [async collection http_parser path stack_trace stream_channel] - shelf_web_socket 1.0.4 [shelf stream_channel web_socket_channel] - sky_engine 0.0.99 - sortedmap 0.5.3 [quiver] - source_gen 1.5.0 [analyzer async build dart_style glob path source_span yaml] - source_helper 1.3.4 [analyzer collection source_gen] - source_span 1.10.0 [collection path term_glyph] - sqflite_common 2.5.4 [synchronized path meta] - sqlite3 2.4.0 [collection ffi js meta path] - stack_trace 1.11.1 [path] - stream_channel 2.1.2 [async] - stream_transform 2.1.0 - string_scanner 1.2.0 [source_span] - term_glyph 1.2.1 - test_api 0.7.0 [async boolean_selector collection meta source_span stack_trace stream_channel string_scanner term_glyph] - timing 1.0.1 [json_annotation] - typed_data 1.3.2 [collection] - universal_io 2.2.2 [collection meta typed_data] - url_launcher_android 6.3.0 [flutter url_launcher_platform_interface] - url_launcher_ios 6.2.5 [flutter url_launcher_platform_interface] - url_launcher_linux 3.1.1 [flutter url_launcher_platform_interface] - url_launcher_macos 3.1.0 [flutter url_launcher_platform_interface] - url_launcher_platform_interface 2.3.2 [flutter plugin_platform_interface] - url_launcher_web 2.3.0 [flutter flutter_web_plugins url_launcher_platform_interface web] - url_launcher_windows 3.1.1 [flutter url_launcher_platform_interface] - vector_graphics 1.1.11+1 [flutter http vector_graphics_codec] - vector_graphics_codec 1.1.11+1 - vector_graphics_compiler 1.1.11+1 [args meta path_parsing xml vector_graphics_codec path] - vector_math 2.1.4 - vm_service 14.2.1 - watcher 1.1.0 [async path] - web 0.5.1 - web_socket 0.1.5 [web] - web_socket_channel 2.4.4 [async crypto stream_channel web] - webview_flutter 4.7.0 [flutter webview_flutter_android webview_flutter_platform_interface webview_flutter_wkwebview] - webview_flutter_android 3.16.0 [flutter webview_flutter_platform_interface] - webview_flutter_platform_interface 2.10.0 [flutter meta plugin_platform_interface] - webview_flutter_wkwebview 3.13.0 [flutter path webview_flutter_platform_interface] - win32 5.3.0 [ffi] - win32_registry 1.1.2 [ffi win32] - x509 0.2.4+2 [asn1lib quiver crypto_keys] - xdg_directories 1.0.4 [meta path] - xml 6.5.0 [collection meta petitparser] - yaml 3.1.2 [collection source_span string_scanner] ```

Additional context and comments

I wonder if it is related with the fact of multiple disks on the machine. It was happening on mine and I had two disks. I have only one now and it does not happen anymore.

The machines where I see it happening had two or more disks as well.

Just a guess.

Another info... I tried running the app as administrator and It worked a few times, but It crashes after some time.

ciceromsjr commented 5 months ago

UPDATE:

In my application, I had disabled Firestore persistence. I tested re-enabling it, and the error did not occur anymore. It worked!

From this

FirebaseFirestore.instance.settings = const Settings(persistenceEnabled: false);

To this

FirebaseFirestore.instance.settings = const Settings(persistenceEnabled: true);

encoder90 commented 5 months ago

I have changed FirebaseFirestore.instance.settings = const Settings(persistenceEnabled: true); but the problem still exists. If I remove firebase folders from %LOCALAPPDATA% the app runs for a single time. but the problem still exists.

ciceromsjr commented 5 months ago

Hi @encoder90

Yes, you are correct. I celebrated too soon...

For some reason, using Firestore persistence, after the first access, the LDB and/or CURRENT files get corrupted. This only happens on some machines and I couldn't identify a pattern among them.

So, what I did to solve it was to clear the persistence as soon as Firebase is initialized, even before opening any screen in the app.

It looks like this:

void main() async { WidgetsFlutterBinding.ensureInitialized();

await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, );

FirebaseFirestore.instance.settings = Settings( // Curiously, it is necessary to enable persistence to avoid a crash where the database of // this cache is not found. However, it is necessary to clear this same cache to avoid the crash due to it being corrupted. // https://github.com/firebase/flutterfire/issues/12987 persistenceEnabled: Platform.isWindows, );

// Curiously, it is necessary to enable persistence to avoid a crash where the database of // this cache is not found. However, it is necessary to clear this same cache // to avoid the crash due to it being corrupted. if (Platform.isWindows) { await FirestoreMF.instance.clearPersistence(); }

I do this only on Windows, as I haven't tested it on other platforms. In any case, it worked in the tests I did.

encoder90 commented 3 months ago

await FirebaseFirestore.instance.clearPersistence(); does the trick, now the application do not closes. But The state of application remain the same, so after restarting the app firebase state perciste. it seems like firebase is not re-initializes after re-running the app. we need to call await FirebaseFirestore.instance.terminate(); to clean app state. and in this case the app crushes again and closes.

richard457 commented 1 month ago

Same problem here

Zhatra commented 2 weeks ago

i wanna kill myself for this problem