Skip to content

chore: add triage information for unexplained startup crash #17477

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

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

mikehardy
Copy link
Member

Purpose / Description

Looking at acrarium, there was a pretty odd crash with a NullPointerException.
Those are usually pretty easy to fix but I couldn't really figure out why on this one:

https://ankidroid.org/acra/app/1/bug/260065/report/ec131296-dcf2-44e3-bd7f-3aa8f34678f6

11-22 07:38:50.977 W/AnkiDroid( 7692): Activity/ java.lang.NullPointerException
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionHelper.getAppSpecificExternalAnkiDroidDirectory(CollectionHelper.kt:225)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionHelper.getDefaultAnkiDroidDirectory(CollectionHelper.kt:189)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionHelper.getCurrentAnkiDroidDirectoryOptionalContext$lambda$2(CollectionHelper.kt:295)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.preferences.PreferenceExtensionsKt.getOrSetString(PreferenceExtensions.kt:36)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionHelper.getCurrentAnkiDroidDirectoryOptionalContext$AnkiDroid_playRelease(CollectionHelper.kt:294)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionManager.getCollectionDirectory(CollectionManager.kt:258)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionManager.collectionPathInValidFolder(CollectionManager.kt:263)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionManager.ensureOpenInner(CollectionManager.kt:243)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionManager.getColUnsafe$lambda$11$lambda$10(CollectionManager.kt:299)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at com.ichi2.anki.CollectionManager$withQueue$3.invokeSuspend(CollectionManager.kt:103)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:111)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.scheduling.TaskImpl.run(Tasks.kt:99)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:584)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.kt:811)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.kt:715)
11-22 07:38:50.977 W/AnkiDroid( 7692): 	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:702)

But external storage appears to be mounted ? So not sure how this returned null.
Maybe there was a race condition between us attempting to access it (while it was still unmounted?) and ACRA attempting to log it and seeing it was mounted by then?

So I don't think we can recover from this but we can provide a custom exception with more information maybe, and can try again later

Fixes

Doesn't fix anything, but shouldn't regress.

Approach

Check for unexpected error condition vs just !!ing the value, and try to log useful information

How Has This Been Tested?

./gradlew jacocoTestReport and the app still runs on my emulator

Learning (optional, can help others)

Reading lots of API docs

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

Copy link
Member

@lukstbit lukstbit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, extra logging will not hurt and we can't really continue at this point anyway.

@lukstbit lukstbit added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Nov 22, 2024
@BrayanDSO BrayanDSO added Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) and removed Needs Second Approval Has one approval, one more approval to merge labels Nov 22, 2024
@BrayanDSO BrayanDSO added this pull request to the merge queue Nov 22, 2024
Merged via the queue into ankidroid:main with commit 3907ca2 Nov 22, 2024
12 checks passed
@github-actions github-actions bot modified the milestones: 2.19.3 release, 2.20 Release Nov 22, 2024
@github-actions github-actions bot removed the Pending Merge Things with approval that are waiting future merge (e.g. targets a future release, CI wait, etc) label Nov 22, 2024
@mikehardy mikehardy deleted the null-external-storage branch November 23, 2024 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants