Skip to content

[cloud_firestore] Crash "An error occurred while executing doInBackground()" #70

Description

I have the feeling that the issue (flutter/flutter#37569) is getting lost in the old repo.

Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
       at android.os.AsyncTask$3.done + 318(AsyncTask.java:318)
       at java.util.concurrent.FutureTask.finishCompletion + 354(FutureTask.java:354)
       at java.util.concurrent.FutureTask.setException + 223(FutureTask.java:223)
       at java.util.concurrent.FutureTask.run + 242(FutureTask.java:242)
       at android.os.AsyncTask$SerialExecutor$1.run + 243(AsyncTask.java:243)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1133(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 607(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run + 760(Thread.java:760)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.firestore.ak com.google.firebase.firestore.ak.a(com.google.firebase.firestore.d, java.lang.Object)' on a null object reference
       at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$7.doInBackground(CloudFirestorePlugin.java)
       at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$7.doInBackground(CloudFirestorePlugin.java)
       at android.os.AsyncTask$2.call + 304(AsyncTask.java:304)
       at java.util.concurrent.FutureTask.run + 237(FutureTask.java:237)
       at android.os.AsyncTask$SerialExecutor$1.run + 243(AsyncTask.java:243)
       at java.util.concurrent.ThreadPoolExecutor.runWorker + 1133(ThreadPoolExecutor.java:1133)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run + 607(ThreadPoolExecutor.java:607)
       at java.lang.Thread.run + 760(Thread.java:760)

I am seeing this on a lot of different devices now. Frequently saw this in pre-launch reports on the Play Store before (mostly Pixel devices), but now I am seeing it from a lot of different devices, e.g. Redmi Note 4, Gemini 4G, and Moto G(4) Plus.

From #hackers-flutterfire..:

I can only find Flutter related results when searching this exception and the issue has not gotten any attention yet.

Occurs in versions cloud_firestore: 0.12.9, Flutter SDK: v1.9.8 and probably versions from the months before that.

Activity

  1. creativecreatorormaybenot commented on Sep 2, 2019

    @creativecreatorormaybenot
    ContributorAuthor

    Another "version" of this crash:

    Fatal Exception: java.lang.RuntimeException: An error occurred while executing doInBackground()
           at android.os.AsyncTask$3.done + 353(AsyncTask.java:353)
           at java.util.concurrent.FutureTask.finishCompletion + 383(FutureTask.java:383)
           at java.util.concurrent.FutureTask.setException + 252(FutureTask.java:252)
           at java.util.concurrent.FutureTask.run + 271(FutureTask.java:271)
           at android.os.AsyncTask$SerialExecutor$1.run + 245(AsyncTask.java:245)
           at java.util.concurrent.ThreadPoolExecutor.runWorker + 1162(ThreadPoolExecutor.java:1162)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run + 636(ThreadPoolExecutor.java:636)
           at java.lang.Thread.run + 764(Thread.java:764)
    
    Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'com.google.firebase.firestore.ak com.google.firebase.firestore.ak.a(com.google.firebase.firestore.d, java.lang.Object)' on a null object reference
           at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$7.doInBackground + 20(CloudFirestorePlugin.java:20)
           at io.flutter.plugins.firebase.cloudfirestore.CloudFirestorePlugin$7.doInBackground + 2(CloudFirestorePlugin.java:2)
           at android.os.AsyncTask$2.call + 333(AsyncTask.java:333)
           at java.util.concurrent.FutureTask.run + 266(FutureTask.java:266)
           at android.os.AsyncTask$SerialExecutor$1.run + 245(AsyncTask.java:245)
           at java.util.concurrent.ThreadPoolExecutor.runWorker + 1162(ThreadPoolExecutor.java:1162)
           at java.util.concurrent.ThreadPoolExecutor$Worker.run + 636(ThreadPoolExecutor.java:636)
           at java.lang.Thread.run + 764(Thread.java:764)
    

    I think adding all the devices it occured on is not useful here, but I can do that if it helps.

  2. creativecreatorormaybenot commented on Sep 2, 2019

    @creativecreatorormaybenot
    ContributorAuthor

    I looked at where doInBackground is used, I can say that I use Transaction#set/update/get but never delete. I have no idea what part of my Dart code is causing these issues.

    Luckily this crash happens a lot in Play Store pre-launch reports and seeing that this happens right after start up when first loading content (UI is already displayed), I think it can only be Transaction#set.

    Update: I suppose what I described here could be #79. The `transaction.set` calls I am looking at use `FieldValue.serverTimestamp()`, so maybe it has something to do with multiple of these transactions piling up? Reason I say this: Sometimes, I see my app crash when there is bad connection and I try to perform an action like "incrementing a value", which is a transaction, and if the bad connection causes the transaction to not update the value (immediately), I will trigger it again manually, and again and after some of these actions "pile" up, the app will crash - so I imagine that this issue is **similar** or that one of these stack traces actually is exactly what I described.

    Most likely it is what I can see in pre-launch recordings: right after start up with Transaction#set's that have FieldValue.serverTimestamp().

    I cannot replicate it in debug mode (probably because I have a stable connection?) and it does not happen to every user, i.e. just a few percent.

  3. locked and limited conversation to collaborators on Aug 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions