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

Crash of the app after sending a draft version of trees update form #6109

Closed
dbemke opened this issue Apr 24, 2024 · 9 comments · Fixed by #6153
Closed

Crash of the app after sending a draft version of trees update form #6109

dbemke opened this issue Apr 24, 2024 · 9 comments · Fixed by #6153
Assignees
Milestone

Comments

@dbemke
Copy link

dbemke commented Apr 24, 2024

ODK Collect version

the master version d27f63e

Android version

10,14

Device used

Redmi 9t, Pixel 7a

Problem description

There is a crash after sending a submission of a draft version of a trees update form.
https://test.getodk.cloud/#/projects/530/forms/trees_update/draft/testing

Steps to reproduce the problem

  1. Create a project in Central.
  2. Upload the form.
    Trees update.xlsx.txt
  3. Go to the testing tab in the draft section and scan the QR code.
  4. Fill the form (with no tree as there are no options) and send the submission.

Expected behavior

The form should be finalized/submitted successfully and no local entity should be created.

Other information

The issue doesn't occur in the store version.

@WKobus
Copy link

WKobus commented Apr 25, 2024

Here is a callstack from logcat

FATAL EXCEPTION: AsyncTask #1 Process: org.odk.collect.android, PID: 2652 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:415) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305) 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:923) Caused by: java.lang.NullPointerException: Parameter specified as non-null is null: method org.odk.collect.entities.Entity.<init>, parameter id at org.odk.collect.entities.Entity.<init>(Unknown Source:7) at org.odk.collect.android.javarosawrapper.JavaRosaFormController.lambda$getEntities$0(Unknown Source:17) at org.odk.collect.android.javarosawrapper.JavaRosaFormController.$r8$lambda$sdKMRboIE2w5nAHI5mamjpJ_k0c(SourceFile:0) at org.odk.collect.android.javarosawrapper.JavaRosaFormController$$ExternalSyntheticLambda0.apply(SourceFile:0) at j$.util.stream.ReferencePipeline$3$1.accept(Unknown Source:6) at j$.util.AbstractList$RandomAccessSpliterator.forEachRemaining(Unknown Source:19) at j$.util.stream.AbstractPipeline.copyInto(Unknown Source:22) at j$.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source:10) at j$.util.stream.ForEachOps$ForEachOp.evaluateSequential(Unknown Source:0) at j$.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(Unknown Source:0) at j$.util.stream.AbstractPipeline.evaluate(Unknown Source:34) at j$.util.stream.ReferencePipeline.forEach(Unknown Source:5) at org.odk.collect.android.tasks.SaveFormToDisk.saveForm(Unknown Source:77) at org.odk.collect.android.formentry.saving.DiskFormSaver.save(Unknown Source:25) at org.odk.collect.android.formentry.saving.FormSaveViewModel$SaveTask.doInBackground(SourceFile:0) at org.odk.collect.android.formentry.saving.FormSaveViewModel$SaveTask.doInBackground(SourceFile:0) at android.os.AsyncTask$3.call(AsyncTask.java:394) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:305)

@seadowg
Copy link
Member

seadowg commented Apr 26, 2024

@dbemke can you check if this still happens in #6108?

@dbemke
Copy link
Author

dbemke commented Apr 26, 2024

@WKobus Could you try and reproduce it the way Callum suggested? If not, I'll do it next week

@WKobus
Copy link

WKobus commented Apr 29, 2024

@seadowg I've reproduced this and it still occurs in #6108

@seadowg seadowg added this to the v2024.2 milestone Apr 29, 2024
@seadowg
Copy link
Member

seadowg commented Apr 29, 2024

@seadowg @WKobus just to confirm: you're not selecting a tree (in the question "Select a tree to update") when filling the form (as there isn't any)? Also, this form won't load in Enketo right?

@WKobus
Copy link

WKobus commented Apr 29, 2024

@seadowg Yeah, I'm not selecting a tree in "Select a tree to update" question, since there isn't any, I've tried opening this form in Enketo and there is loading error.

@seadowg
Copy link
Member

seadowg commented Apr 29, 2024

@lognaturel we should discuss how Collect should behave in this situation (an empty entity list). Granted this form should probably make the "Select a tree to update" question required (it's broken otherwise), but we should definitely avoid a crash. My thinking is that filling this form should work given the fact that we're supporting empty/missing entity lists.

@lognaturel
Copy link
Member

Does the issue happen at form finalization time because it tries to update an entity with a blank entity id? I agree that this is mostly a form design issue. I think we should probably catch all of these kinds of finalization issues, maybe log them (something like "failed to update entity with id "" from submission "2345-23423..."), and still finalize/submit. It feels like this class of issue is best dealt with on the server where there is already specialized error handling. We could even consider showing some kind of warning message but I don't think we should block submission.

@seadowg
Copy link
Member

seadowg commented Apr 30, 2024

Agreed! I'll update the issue description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: done
Development

Successfully merging a pull request may close this issue.

4 participants