Skip to content

[cloud_firestore]: Android Firestore initialization fails on second launch with ConcurrentModificationException #17954

Description

@xiaojianli

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Database

Which platforms are affected?

Android

Description

https://github.com/firebase/flutterfire/issues/17826

This issue remains unresolved. Judging from the comments, it appears to be a bug in the cloud_firestore plugin. The final commit that closed this issue modified the firebase_database plugin.

This is an error with the cloud_firestore plugin.

E/flutter (18312): at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestorePlugin.lambda$didReinitializeFirebaseCore$1(FlutterFirebaseFirestorePlugin.java:207)
E/flutter (18312): at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestorePlugin.$r8$lambda$LWPUzGoM67fJ0VnXoPogtvBOysE(Unknown Source:0)
E/flutter (18312): at io.flutter.plugins.firebase.firestore.FlutterFirebaseFirestorePlugin$$ExternalSyntheticLambda5.run(D8$$SyntheticClass:0)
E/flutter (18312): ... 3 more

https://github.com/firebase/flutterfire/pull/17864 This fixes the bug in the firebase_database plugin.
https://github.com/firebase/flutterfire/pull/17864/commits/0b91976754bb45f9f3436ad695b41a36f9785372 This commit only modified the firebase_database package.

Why was this issue closed?

The issue still exists in the latest version of cloud_firestore.

Reproducing the issue

final app = Firebase.app();

final mainFirestore = FirebaseFirestore.instanceFor(
app: app,
databaseId: 'main-db',
);

mainFirestore.settings = const Settings(
persistenceEnabled: true,
cacheSizeBytes: Settings.CACHE_SIZE_UNLIMITED,
);

final appConfig = FirebaseFirestore.instanceFor(
app: app,
databaseId: 'app-config',
);

appConfig.settings = const Settings(
persistenceEnabled: true,
cacheSizeBytes: Settings.CACHE_SIZE_UNLIMITED,
);
appConfig.disableNetwork();

Firebase Core version

4.3.0

Flutter Version

3.38.6

Relevant Log Output

Flutter dependencies

Expand Flutter dependencies snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.

Additional context and comments

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions