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 when exporting collection with time data while using SchedV2 #6145

Closed
Arthus opened this issue May 10, 2020 · 7 comments · Fixed by #6154
Closed

Crash when exporting collection with time data while using SchedV2 #6145

Arthus opened this issue May 10, 2020 · 7 comments · Fixed by #6154
Labels
Bug Reproduced This bug has been reproduced by a maintainer V2 Scheduler

Comments

@Arthus
Copy link
Contributor

Arthus commented May 10, 2020

Reproduction Steps
  1. Open AnkiDroid with two decks and several sub deck. Enable Scheduler V2
  2. Try to export a single deck with time data
  3. Try to export whole collection without time data
  4. Try to export whole collection while including time data
Expected Result

Trying to export a single deck shows a warning, that exporting single decks with time data is only supported with SchedV1.
When exporting the complete collection with time data, no such warning is shown, so I expect it to be able to export the collection

Actual Result

Using SchedV2 the collection can be exported without the time data.

When the time data is selected for export, AnkiDroid crashes without further notice when trying to export the collection.

Debug info

AnkiDroid Version = 2.10beta3

Android Version = 10

ACRA UUID = 521087f7-500c-4737-9177-e052dde31e0e

Research

[ x ] I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid

[ x ] I have checked the manual and the FAQ and could not find a solution to my issue

[ x ] I have searched for similar existing issues here and on the user forum

@david-allison
Copy link
Member

https://couchdb.ankidroid.org/acralyzer/_design/acralyzer/index.html#/reports-browser/user/521087f7-500c-4737-9177-e052dde31e0e

java.lang.RuntimeException: An error occurred while executing doInBackground()
at android.os.AsyncTask$4.done(AsyncTask.java:399)
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:289)
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:919)
Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.Object android.util.Pair.first' on a null object reference
at com.ichi2.libanki.Note._fieldOrd(Note.java:1)
at com.ichi2.libanki.Note.setItem(Note.java:1)
at com.ichi2.libanki.AnkiPackageExporter._addDummyCollection(AnkiPackageExporter.java:6)
at com.ichi2.libanki.AnkiPackageExporter.exportVerbatim(AnkiPackageExporter.java:5)
at com.ichi2.libanki.AnkiPackageExporter.exportInto(AnkiPackageExporter.java:4)
at com.ichi2.async.CollectionTask.doInBackgroundExportApkg(CollectionTask.java:12)
at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.java:35)
at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.java:1)
at android.os.AsyncTask$3.call(AsyncTask.java:378)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
... 4 more

@david-allison
Copy link
Member

Presumption: Front doesn't exist.

Does this work when you change your system language to English?

private void _addDummyCollection(ZipFile zip, Context context) throws IOException {
File f = File.createTempFile("dummy", ".anki2");
String path = f.getAbsolutePath();
f.delete();
Collection c = Storage.Collection(context, path);
Note n = c.newNote();
n.setItem("Front", context.getString(R.string.export_v2_dummy_note));
c.addNote(n);
c.save();
c.close();
zip.write(f.getAbsolutePath(), CollectionHelper.COLLECTION_FILENAME);
}

@Arthus
Copy link
Contributor Author

Arthus commented May 10, 2020

Before trying to change my system language, I just tried only setting AnkiDroid's language in the preferences to English and it works.

I guess in that case it should also work with the system language set to English and using "System default" as setting in AnkiDroid. If you want me to confirm this, please let me know. For now, I'm going to be lazy. ;)

@david-allison
Copy link
Member

Laziness is a virtue, I think that's all we need to know 😉.

Caused confirmed: We're not translating Front

Any preference? Want to take on fixing this? I'm more than happy to. Your call

@david-allison david-allison added Bug Reproduced This bug has been reproduced by a maintainer V2 Scheduler labels May 10, 2020
@Arthus
Copy link
Contributor Author

Arthus commented May 10, 2020

I can try fixing this. If I take too long or someone else runs into this and the priority gets higher, you might want to take over or I might call for help.

Btw. is there any other way to talk to you guys, aside the issue tracker/PRs and the forums? Any developer IRC channel or something like this?

@david-allison
Copy link
Member

Nothing official, but we started using discord a few weeks ago: https://discord.gg/ZbUqCa

@mikehardy
Copy link
Member

How amusing - Google runs a bunch of devices in a crawler mode against the app on every release, and normally there are no crashes these days but wouldn't you know the 2.10beta4 and 2.11alpha1 builds both had a single crash, right in this code:

05-10 16:22:45.995: E/AndroidRuntime(18919): java.lang.RuntimeException: An error occurred while executing doInBackground()
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at android.os.AsyncTask$4.done(AsyncTask.java:399)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.util.concurrent.FutureTask.run(FutureTask.java:271)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.lang.Thread.run(Thread.java:919)
05-10 16:22:45.995: E/AndroidRuntime(18919): Caused by: java.lang.NullPointerException: Attempt to read from field 'java.lang.Object android.util.Pair.first' on a null object reference
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.libanki.Note._fieldOrd(Note.java:1)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.libanki.Note.setItem(Note.java:1)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.libanki.AnkiPackageExporter._addDummyCollection(AnkiPackageExporter.java:6)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.libanki.AnkiPackageExporter.exportVerbatim(AnkiPackageExporter.java:5)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.libanki.AnkiPackageExporter.exportInto(AnkiPackageExporter.java:5)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.async.CollectionTask.doInBackgroundExportApkg(CollectionTask.java:12)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.java:35)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.java:1)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at android.os.AsyncTask$3.call(AsyncTask.java:378)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
05-10 16:22:45.995: E/AndroidRuntime(18919): 	... 4 more

That doesn't increase priority or add information (unless you didn't know we had an auto-crawl on each release, that's interesting info) but is an amazing coincidence

Apochens added a commit to Apochens/Anki-Android that referenced this issue Sep 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Reproduced This bug has been reproduced by a maintainer V2 Scheduler
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants