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

The application crashes after answering a card and quickly mounting the sd card #941

Closed
hssm opened this issue Jul 28, 2015 · 4 comments
Closed

Comments

@hssm
Copy link
Member

hssm commented Jul 28, 2015

Originally reported on Google Code with ID 38

What steps will reproduce the problem?
1. Navigate to DeckPicker (Menu > Switch to another deck)
2. Select a deck with cards to review
3. Answer a card and quickly mount the sd card

When you answer the card a thread is launched to update and commit the
changes asynchronously and if the connection with the DB is lost while
doing it (like mounting the sd card) an Exception is thrown and the app
crashes.

12-07 13:38:07.442: ERROR/AndroidRuntime(3133): Uncaught handler: thread
AsyncTask #1 exiting due to uncaught exception
12-07 13:38:07.472: ERROR/AndroidRuntime(3133): java.lang.RuntimeException:
An error occured while executing doInBackground()
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
android.os.AsyncTask$3.done(AsyncTask.java:200)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:234)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:258)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.util.concurrent.FutureTask.run(FutureTask.java:122)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:648)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:673)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.lang.Thread.run(Thread.java:1058)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133): Caused by:
java.lang.NullPointerException
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.Stats.toDB(Stats.java:207)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.Stats.updateStats(Stats.java:241)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.Stats.updateAllStats(Stats.java:218)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.Deck.answerCard(Deck.java:776)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.DeckTask.doInBackgroundAnswerCard(DeckTask.java:115)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.DeckTask.doInBackground(DeckTask.java:66)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
com.ichi2.anki.DeckTask.doInBackground(DeckTask.java:1)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
android.os.AsyncTask$2.call(AsyncTask.java:185)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:256)
12-07 13:38:07.472: ERROR/AndroidRuntime(3133):     ... 4 more

What could we do about that? I think it's impossible to really finish the
commit so the options that I thought are:

- Show to the user a message informing him that the data could not be saved :(
- Use some structure or database like a backup and commit to the real deck
when the connection with the database is available again

Do you have any other idea?

Reported by edu.zasu on 2009-12-07 12:56:27

@hssm
Copy link
Member Author

hssm commented Jul 28, 2015

Reported by edu.zasu on 2009-12-08 06:25:03

@hssm
Copy link
Member Author

hssm commented Jul 28, 2015

I am not sure, but I think I have fixed this while fixing another bug. Ankidroid now
blocks in closeExternalStorageFiles() until the thread finishes. Hopefully, Android
will not unmount the sdcard until this has finished. Also, answering has been made
much quicker now, so this might not be such a big problem.

Could you please verify this again with a copy from my master branch on github?

Reported by daniel.svard on 2010-02-23 12:37:02

@hssm
Copy link
Member Author

hssm commented Jul 28, 2015

Reported by daniel.svard on 2010-02-28 13:27:51

  • Status changed: FixedInDev

@hssm
Copy link
Member Author

hssm commented Jul 28, 2015

Reported by nicolas.raoul on 2010-03-16 07:28:15

  • Status changed: Fixed

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

No branches or pull requests

1 participant