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.64k stars 3.96k forks source link

[cloud_firestore] Fatal Exception: java.util.ConcurrentModificationException #11165

Closed muriloventuroso closed 9 months ago

muriloventuroso commented 1 year ago

Bug report

While running the Android app, the following error was reported in the crash log.

Exception java.util.ConcurrentModificationException:
  at java.util.ArrayList$Itr.next (ArrayList.java:860)
  at com.google.firebase.firestore.core.Query.matchesOrderBy (Query.java:401)
  at com.google.firebase.firestore.core.Query.matches (Query.java:425)
  at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.lambda$getDocumentsMatchingQuery$3 (SQLiteRemoteDocumentCache.java:257)
  at com.google.firebase.firestore.local.SQLiteRemoteDocumentCache.lambda$processRowInBackground$2 (SQLiteRemoteDocumentCache.java:242)
  at com.google.firebase.firestore.util.BackgroundQueue.lambda$execute$0 (BackgroundQueue.java:39)
  at com.google.firebase.firestore.util.ThrottledForwardingExecutor.lambda$execute$0 (ThrottledForwardingExecutor.java:54)
  at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1167)
  at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:641)
  at java.lang.Thread.run (Thread.java:919)

Steps to reproduce

I still haven't been able to reproduce the error on my Android devices or the emulator. But I get this error report everyday from my app users.

Additional context

Occurs on Android 10 (SDK 29)


Flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4 22F66 darwin-arm64, locale pt-BR)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.79.0)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!


Flutter dependencies

- asuka 2.0.1 [flutter]
- auto_size_text_pk 3.0.0 [flutter]
- banner_carousel 1.2.1 [flutter]
- bluetooth_print 4.2.0 [flutter json_annotation rxdart]
- cached_network_image 3.2.3 [flutter flutter_cache_manager octo_image cached_network_image_platform_interface cached_network_image_web]
- clipboard 0.1.3 [flutter]
- cloud_firestore 4.8.1 [cloud_firestore_platform_interface cloud_firestore_web collection firebase_core firebase_core_platform_interface flutter meta]
- cloud_functions 4.3.3 [cloud_functions_platform_interface cloud_functions_web firebase_core firebase_core_platform_interface flutter]
- contacts_service 0.6.3 [flutter collection quiver]
- cupertino_icons 1.0.5
- currency_picker 2.0.5 [collection flutter]
- dart_code_metrics 5.7.5 [analyzer analyzer_plugin ansicolor args collection crypto dart_code_metrics_presets file glob html http meta path platform pub_updater source_span uuid xml yaml]
- dart_date 1.2.1 [intl timeago]
- device_calendar 4.3.1 [flutter collection sprintf timezone flutter_native_timezone]
- dio 5.2.1+1 [async http_parser meta path]
- drag_and_drop_gridview 2.0.1 [flutter]
- easy_refresh 3.3.2+1 [flutter path_drawing]
- equatable 2.0.5 [collection meta]
- esc_pos_utils 1.1.0 [flutter hex gbk_codec image]
- excel 2.1.0 [archive xml collection equatable]
- extended_masked_text 2.3.1 [flutter]
- fast_barcode_scanner 1.1.4 [flutter fast_barcode_scanner_platform_interface]
- firebase_analytics 10.4.3 [firebase_analytics_platform_interface firebase_analytics_web firebase_core firebase_core_platform_interface flutter]
- firebase_auth 4.6.3 [firebase_auth_platform_interface firebase_auth_web firebase_core firebase_core_platform_interface flutter meta]
- firebase_core 2.14.0 [firebase_core_platform_interface firebase_core_web flutter meta]
- firebase_in_app_messaging 0.7.3+3 [firebase_core firebase_core_platform_interface firebase_in_app_messaging_platform_interface flutter meta]
- firebase_messaging 14.6.3 [firebase_core firebase_core_platform_interface firebase_messaging_platform_interface firebase_messaging_web flutter meta]
- firebase_performance 0.9.2+3 [firebase_core firebase_core_platform_interface firebase_performance_platform_interface firebase_performance_web flutter]
- firebase_storage 11.2.3 [firebase_core firebase_core_platform_interface firebase_storage_platform_interface firebase_storage_web flutter]
- fl_chart 0.62.0 [equatable flutter]
- flutter 0.0.0 [characters collection js material_color_utilities meta vector_math sky_engine]
- flutter_app_badger 1.5.0 [flutter]
- flutter_circle_color_picker 0.3.0 [flutter]
- flutter_colorpicker 1.0.3 [flutter]
- flutter_facebook_auth 5.0.11 [flutter flutter_facebook_auth_platform_interface flutter_facebook_auth_web facebook_auth_desktop]
- flutter_image_compress 2.0.3 [flutter flutter_image_compress_platform_interface flutter_image_compress_common flutter_image_compress_web]
- flutter_launcher_icons 0.11.0 [args checked_yaml cli_util image json_annotation path yaml]
- flutter_local_notifications 14.1.1 [clock flutter flutter_local_notifications_linux flutter_local_notifications_platform_interface timezone]
- flutter_localizations 0.0.0 [flutter intl characters clock collection js material_color_utilities meta path vector_math]
- flutter_mobx 2.0.6+5 [flutter mobx]
- flutter_modular 5.0.3 [flutter_modular_annotations modular_core meta flutter]
- flutter_native_splash 2.2.16 [args flutter flutter_web_plugins js html image meta path universal_io xml yaml]
- flutter_native_timezone 2.0.1 [flutter_web_plugins flutter js]
- flutter_screenutil 5.8.4 [flutter]
- flutter_slidable 3.0.0 [flutter]
- flutter_web_auth 0.4.1 [flutter flutter_web_plugins]
- flutter_web_plugins 0.0.0 [flutter js characters collection material_color_utilities meta vector_math]
- google_mobile_ads 2.4.0 [meta flutter visibility_detector]
- google_sign_in 6.1.4 [flutter google_sign_in_android google_sign_in_ios google_sign_in_platform_interface google_sign_in_web]
- hive 2.2.3 [meta crypto]
- hive_flutter 1.1.0 [flutter hive path_provider path]
- horizontal_data_table 4.3.1 [flutter provider]
- i18n_extension 9.0.2 [sprintf args equatable intl flutter]
- idb_shim 2.3.1 [sembast collection path js meta]
- image_picker 0.8.9 [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_review 2.0.6 [flutter in_app_review_platform_interface]
- intl 0.18.0 [clock meta path]
- intro_views_flutter 3.2.0 [flutter]
- loader_overlay 2.2.0 [flutter back_button_interceptor]
- logger 1.4.0
- lottie 2.4.0 [archive flutter path vector_math]
- maps_launcher 2.2.0 [flutter flutter_web_plugins url_launcher]
- material_design_icons_flutter 6.0.7296 [flutter]
- mobx 2.2.0 [meta]
- numeric_keyboard 1.1.0 [flutter]
- octo_image 1.0.2 [flutter flutter_blurhash]
- overlay_support 2.1.0 [flutter async]
- package_info_plus 4.0.2 [ffi flutter flutter_web_plugins http meta path package_info_plus_platform_interface win32]
- page_transition 2.0.9 [flutter]
- path_provider 2.0.15 [flutter path_provider_android path_provider_foundation path_provider_linux path_provider_platform_interface path_provider_windows]
- percent_indicator 4.2.3 [flutter]
- permission_handler 10.3.0 [flutter meta permission_handler_android permission_handler_apple permission_handler_windows permission_handler_platform_interface]
- purchases_flutter 5.0.0 [flutter freezed_annotation json_annotation]
- responsive_grid 2.3.0 [flutter]
- screenshot 2.1.0 [flutter]
- scrollable_positioned_list 0.3.8 [flutter collection]
- select_dialog 2.0.0 [flutter]
- sentry_flutter 7.7.0 [flutter flutter_web_plugins sentry package_info_plus meta]
- share_plus 7.0.2 [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 win32]
- shared_preferences 2.1.2 [flutter shared_preferences_android shared_preferences_foundation shared_preferences_linux shared_preferences_platform_interface shared_preferences_web shared_preferences_windows]
- shimmer_animation 2.1.0+1 [flutter]
- sign_button 2.0.4 [flutter]
- sign_in_with_apple 4.3.0 [flutter meta sign_in_with_apple_platform_interface sign_in_with_apple_web]
- slugify 2.0.0
- table_calendar 3.0.9 [flutter intl simple_gesture_detector]
- timelines 0.1.0 [flutter]
- touch_indicator 2.0.0 [flutter]
- universal_html 2.2.3 [async csslib charcode collection html meta source_span typed_data universal_io]
- url_launcher 6.1.11 [flutter url_launcher_android url_launcher_ios url_launcher_linux url_launcher_macos url_launcher_platform_interface url_launcher_web url_launcher_windows]
- uuid 3.0.7 [crypto]
- vibration 1.7.7 [flutter]


darshankawar commented 1 year ago

Thanks for the report @muriloventuroso The log indicates the error seems to be coming from native Android and not from cloud_firestore plugin as I don't see any entries related to the plugin in it. Do you have any more stacktrace that shows any entries from the plugin ?

muriloventuroso commented 1 year ago

I don't have another stacktrace. I should open the issue in the firebase-android-sdk?

darshankawar commented 1 year ago

I think so. If you get directed here, you may reopen the issue.

google-oss-bot commented 1 year ago

Hey @muriloventuroso. 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!

muriloventuroso commented 1 year ago

Possible solution: https://github.com/firebase/firebase-android-sdk/pull/5099

darshankawar commented 1 year ago

@muriloventuroso Did you get a chance to file an issue there ? If so can you link it here for reference ?

muriloventuroso commented 1 year ago

Issue in Firebase Android SDK: https://github.com/firebase/firebase-android-sdk/issues/5091

russellwheatley commented 9 months ago

This issue was a bug in the Firebase android SDK, and has been fixed a while ago: https://github.com/firebase/firebase-android-sdk/issues/5091. Thanks for the report.