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

ANR when viewing hierarchy #6470

Open
seadowg opened this issue Oct 23, 2024 · 0 comments
Open

ANR when viewing hierarchy #6470

seadowg opened this issue Oct 23, 2024 · 0 comments
Labels
Milestone

Comments

@seadowg
Copy link
Member

seadowg commented Oct 23, 2024

Blocked by #5420

It's possible to get an ANR when switching the form hierarchy because question answers (which might be select choices) are loaded on the UI thread.

Here's an example report on Firebase: https://console.firebase.google.com/project/api-project-322300403941/crashlytics/app/android:org.odk.collect.android/issues/7008892868d636bf1de977208e794766?time=last-seven-days&types=ANR&sessionEventKey=6718E7D5026C000179EA52BFDE85A64E_2007392971344283898.

Example stacktrace:

          main (runnable):tid=1 systid=30278 
       at java.util.ArrayList.get(ArrayList.java:434)
       at org.javarosa.core.model.instance.TreeReference.getName(TreeReference.java:126)
       at org.javarosa.core.model.instance.DataInstance.resolveReference(DataInstance.java:84)
       at org.javarosa.xpath.expr.XPathPathExprEval.removeIrrelevantNodesets(XPathPathExprEval.java:42)
       at org.javarosa.xpath.expr.XPathPathExprEval.eval(XPathPathExprEval.java:35)
       at org.javarosa.xpath.expr.XPathPathExpr.eval(XPathPathExpr.java:213)
       at org.javarosa.xpath.expr.XPathPathExpr.eval(XPathPathExpr.java:60)
       at org.javarosa.xpath.expr.XPathFuncExpr.eval(XPathFuncExpr.java:187)
       at org.javarosa.xpath.expr.XPathEqExpr.eval(XPathEqExpr.java:56)
       at org.javarosa.xpath.expr.XPathBoolExpr.eval(XPathBoolExpr.java:43)
       at org.javarosa.core.model.condition.RawFilterStrategy.filter(RawFilterStrategy.java:32)
       at org.javarosa.core.model.condition.EvaluationContext.filterWithPredicate(EvaluationContext.java:382)
       at org.javarosa.core.model.condition.EvaluationContext.lambda$filterWithPredicate$0(EvaluationContext.java:383)
       at org.javarosa.core.model.ComparisonExpressionCacheFilterStrategy.filter(ComparisonExpressionCacheFilterStrategy.java:52)
       at org.javarosa.core.model.condition.EvaluationContext.filterWithPredicate(EvaluationContext.java:382)
       at org.javarosa.core.model.condition.EvaluationContext.lambda$filterWithPredicate$0(EvaluationContext.java:383)
       at org.javarosa.core.model.EqualityExpressionIndexFilterStrategy.filter(EqualityExpressionIndexFilterStrategy.java:33)
       at org.javarosa.core.model.condition.EvaluationContext.filterWithPredicate(EvaluationContext.java:382)
       at org.javarosa.core.model.condition.EvaluationContext.filterWithPredicate(EvaluationContext.java:377)
       at org.javarosa.core.model.condition.EvaluationContext.expandReferenceAccumulator(EvaluationContext.java:343)
       at org.javarosa.core.model.condition.EvaluationContext.expandReference(EvaluationContext.java:250)
       at org.javarosa.core.model.condition.EvaluationContext.expandReference(EvaluationContext.java:219)
       at org.javarosa.xpath.expr.XPathPathExprEval.eval(XPathPathExprEval.java:34)
       at org.javarosa.xpath.expr.XPathPathExpr.eval(XPathPathExpr.java:213)
       at org.javarosa.xpath.XPathConditional.evalNodeset(XPathConditional.java:94)
       at org.javarosa.core.model.ItemsetBinding.getChoices(ItemsetBinding.java:125)
       at org.javarosa.form.api.FormEntryPrompt.getSelectChoices(FormEntryPrompt.java:222)
       at org.javarosa.form.api.FormEntryPrompt.getAnswerValue(FormEntryPrompt.java:98)
       at org.javarosa.form.api.FormEntryPrompt.getAnswerText(FormEntryPrompt.java:154)
       at org.odk.collect.android.formhierarchy.QuestionAnswerProcessor.getQuestionAnswer(QuestionAnswerProcessor.kt:28)
       at org.odk.collect.android.formhierarchy.FormHierarchyActivity.refreshView(FormHierarchyActivity.java:672)
       at org.odk.collect.android.formhierarchy.FormHierarchyActivity.refreshView(FormHierarchyActivity.java:591)
       at org.odk.collect.android.formhierarchy.FormHierarchyActivity.onCreate(FormHierarchyActivity.java:278)
       at org.odk.collect.android.formhierarchy.ViewOnlyFormHierarchyActivity.onCreate(ViewOnlyFormHierarchyActivity.kt:16)
       at android.app.Activity.performCreate(Activity.java:8936)
       at android.app.Activity.performCreate(Activity.java:8900)
       at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1456)
       at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4287)
       at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4459)
       at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:103)
       at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:139)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:96)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2853)
       at android.os.Handler.dispatchMessage(Handler.java:108)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:328)
       at android.app.ActivityThread.main(ActivityThread.java:9223)
       at java.lang.reflect.Method.invoke(Native method)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:594)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1099)

Notes

Once this is fixed, we should be able to remove the StrictMode workarounds for the hierarchy added in #6456.

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

No branches or pull requests

1 participant