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]: Firestore Crash on Windows When Fetching Large Amounts of Data in Batches #17073

Open
1 task done
AlexandreMaillot opened this issue Feb 11, 2025 · 1 comment
Labels
Needs Attention This issue needs maintainer attention. platform: windows Issues / PRs which are specifically for Windows. plugin: cloud_firestore type: bug Something isn't working

Comments

@AlexandreMaillot
Copy link

Is there an existing issue for this?

  • I have searched the existing issues.

Which plugins are affected?

Other

Which platforms are affected?

Windows

Description

When retrieving a large number of Firestore documents in batches on Windows, the application crashes without any clear error message.
The same implementation works correctly on Android, but on Windows, the app suddenly closes during data retrieval.

•	Flutter version: [flutter --version]
•	Firebase Firestore package: [cloud_firestore: 5.0.0]
•	Affected platform: ❌ Windows, ✅ Android (works correctly)
•	Offline mode enabled: true or false
•	Method used: Batch retrieval (limit(X) + startAfterDocument())

✅ Expected Behavior

The application should not crash, and data retrieval should work as expected on Windows, just like on Android.

🚨 Observed Behavior
• The application suddenly closes on Windows without any error message in the console.
• This happens when fetching a large number of documents from Firestore (5000 documents).
• The issue occurs even when retrieving data in batches using limit(X) + startAfterDocument().

📌 Code Snippet

`// ignore_for_file: parameter_assignments';

import 'dart:io';

import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/foundation.dart';

class RecupereParPaquetDocuments {
Future<List> excute({
required RecupereParPaquetDocumentsCommand command,
}) async {
DocumentSnapshot? lastDocument;

final documents = <T>[];

var premierPassage = true;
while (lastDocument != null || premierPassage) {
  premierPassage = false;
  lastDocument =
      await getDocumentParPaquet(command, lastDocument, documents);
}

return documents;

}

Future<DocumentSnapshot<Object?>?> getDocumentParPaquet(
RecupereParPaquetDocumentsCommand command,
DocumentSnapshot<Object?>? lastDocument,
List<T?> documents,
) async {
var query = command.queryCollectionReference.limit(command.paquetDeCombien);
if (lastDocument != null) {
query = query.startAfterDocument(lastDocument);
}

final querySnapshot = await query.get();

if (querySnapshot.docs.isNotEmpty) {
  lastDocument = querySnapshot.docs.last;
  final queryDocs = querySnapshot.docs.map<T>((e) {
    return e.data() as T;
  }).toList();

  documents.addAll(queryDocs);
}
if (kDebugMode) {
  print(documents.length);
}
if (querySnapshot.docs.length < command.paquetDeCombien) {
  return null;
}

return lastDocument!;

}
}

class RecupereParPaquetDocumentsCommand {
RecupereParPaquetDocumentsCommand({
required this.queryCollectionReference,
required this.paquetDeCombien,
});

final Query queryCollectionReference;
final int paquetDeCombien;
}
`

Reproducing the issue

1.	Retrieve a large number of documents (5000) from Firestore using pagination (limit(X) + startAfterDocument()) or not.
2.	Run the app on Windows and attempt to fetch all documents in batches.
3.	Observe the application crash without an error message.

Firebase Core version

3.0.0

Flutter Version

3.27.1

Relevant Log Output

Détecteur d'erreurs 2180041200361686397, type 4
Nom d’événement : APPCRASH
Réponse : Non disponible
ID de CAB : 0

Signature du problème : 
P1 : biziinext.exe
P2 : 1.0.0.0
P3 : 67aae815
P4 : biziinext.exe
P5 : 1.0.0.0
P6 : 67aae815
P7 : c000001d
P8 : 000000000178b0da
P9 : 
P10 : 

Fichiers joints :
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.18278794-2281-4f6c-bbe8-836f5d0aa390.tmp.dmp
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.a458f14b-a3fa-4a98-ab56-45b3a713ad29.tmp.WERInternalMetadata.xml
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.02867f29-b39c-412c-87b1-a5061e495ac8.tmp.csv
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.374bcced-0ef2-409d-a7c3-3d7364a0ca6d.tmp.txt
\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER.8f045c04-1e9c-4108-a31a-69442dd3e6dc.tmp.xml

Ces fichiers sont peut-être disponibles ici :
\\?\C:\ProgramData\Microsoft\Windows\WER\ReportArchive\AppCrash_biziinext.exe_9ac644f58b81fafc890a9db9ff7ce9aa15d8d56_0a8cb9cc_7b00bbd3-8790-4d32-a778-a7fc2ffc89c0

Symbole d’analyse : 
Nouvelle recherche de la solution : 0
ID de rapport : afbbb47c-71c3-4658-b3e3-bc5015dc5c31
Statut du rapport : 268435456
Récipient avec hachage : 2a0b8f235e55d01e4e410febdf46457d
GUID CAB :0


//////////////////////////


Windows ne peut pas accéder au fichier  pour une des raisons suivantes : un problème s’est produit avec la connexion réseau, le disque sur lequel le fichier est enregistré, ou les pilotes de stockage installés sur cet ordinateur, ou le disque est manquant. Windows a fermé le programme biziinext en raison de cette erreur.

Programme : biziinext
Fichier : 

La valeur de l’erreur est affichée dans la section Données supplémentaires.
Action utilisateur
1. Ouvrez à nouveau le fichier. Cette situation peut résulter d’un problème temporaire qui se corrigera de lui-même à la prochaine exécution du programme.
2. Si le fichier est toujours inaccessible et
	- Il se trouve sur le réseau : votre administrateur réseau devrait vérifier qu’il n’y a aucun problème avec le réseau et que le serveur peut être contacté.
	- Il se trouve sur un disque amovible, par exemple une disquette ou un CD-ROM : vérifiez que le disque est inséré correctement dans l’ordinateur.
3. Vérifiez et réparez le système de fichiers en exécutant CHKDSK. Pour exécuter CHKDSK, cliquez sur Démarrer, Exécuter, entrez CMD puis cliquez sur OK. À l’invite de commandes, entrez CHKDSK /F et appuyez sur Entrée.
4. Si le problème persiste, restaurez le fichier à partir d’une copie de sauvegarde.
5. Déterminez si d’autres fichiers du même disque peuvent être ouverts. Si ce n’est pas le cas, le disque est peut-être endommagé. S’il s’agit d’un disque dur, contactez votre administrateur ou le distributeur de votre ordinateur pour obtenir une assistance supplémentaire.

Données supplémentaires
Valeur de l’erreur : 0x0
Type du disque : 0x0

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

@AlexandreMaillot AlexandreMaillot added Needs Attention This issue needs maintainer attention. type: bug Something isn't working labels Feb 11, 2025
@SelaseKay SelaseKay added plugin: cloud_firestore platform: windows Issues / PRs which are specifically for Windows. labels Feb 11, 2025
@SelaseKay
Copy link
Contributor

cc @russellwheatley

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Attention This issue needs maintainer attention. platform: windows Issues / PRs which are specifically for Windows. plugin: cloud_firestore type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants