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 in new schema attempting to delete unused media when doing a media check #12026

Closed
mikehardy opened this issue Aug 14, 2022 · 1 comment · Fixed by #11849
Closed

Crash in new schema attempting to delete unused media when doing a media check #12026

mikehardy opened this issue Aug 14, 2022 · 1 comment · Fixed by #11849
Milestone

Comments

@mikehardy
Copy link
Member

Took a crash attempting to delete unused media when doing a media check on a pretty trashy collection - shouldn't crash ever but what's the best way to handle it? Perhaps just show an info that deletion failed because system threw error %s ?

I/System.out( 6213): localized: "IoError(\"Os { code: 1, kind: PermissionDenied, message: \\\"Operation not permitted\\\" }\")"
I/System.out( 6213): kind: IO_ERROR
D/UsageAnalytics( 6213): sendAnalyticsException() description/fatal: net.ankiweb.rsdroid.exceptions.BackendIoException: IoError("Os { code: 1, kind: PermissionDenied, message: \"Operation not permitted\" }")/true
I/ACRA    ( 6213): ACRA is disabled for com.ichi2.anki - forwarding uncaught Exception on to default ExceptionHandler
--------- beginning of crash
E/AndroidRuntime( 6213): FATAL EXCEPTION: AsyncTask #3
E/AndroidRuntime( 6213): Process: com.ichi2.anki, PID: 6213
E/AndroidRuntime( 6213): java.lang.RuntimeException: An error occured while executing doInBackground()
E/AndroidRuntime( 6213): 	at android.os.AsyncTask$3.done(AsyncTask.java:300)
E/AndroidRuntime( 6213): 	at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
E/AndroidRuntime( 6213): 	at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
E/AndroidRuntime( 6213): 	at java.util.concurrent.FutureTask.run(FutureTask.java:242)
E/AndroidRuntime( 6213): 	at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
E/AndroidRuntime( 6213): 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
E/AndroidRuntime( 6213): 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
E/AndroidRuntime( 6213): 	at java.lang.Thread.run(Thread.java:818)
E/AndroidRuntime( 6213): Caused by: net.ankiweb.rsdroid.exceptions.BackendIoException: IoError("Os { code: 1, kind: PermissionDenied, message: \"Operation not permitted\" }")
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.BackendException$Companion.fromError(BackendException.kt:117)
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.BackendKt.unpackResult(Backend.kt:323)
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.BackendKt.access$unpackResult(Backend.kt:1)
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(Backend.kt:130)
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.Backend$runMethodRaw$1.invoke(Backend.kt:129)
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.Backend.withBackend(Backend.kt:157)
E/AndroidRuntime( 6213): 	at net.ankiweb.rsdroid.Backend.runMethodRaw(Backend.kt:129)
E/AndroidRuntime( 6213): 	at anki.backend.GeneratedBackend.trashMediaFilesRaw(GeneratedBackend.kt:3200)
E/AndroidRuntime( 6213): 	at anki.backend.GeneratedBackend.trashMediaFiles(GeneratedBackend.kt:3210)
E/AndroidRuntime( 6213): 	at com.ichi2.libanki.BackendMedia.removeFiles(BackendMedia.kt:59)
E/AndroidRuntime( 6213): 	at com.ichi2.async.CollectionTask$DeleteMedia.task(CollectionTask.kt:1124)
E/AndroidRuntime( 6213): 	at com.ichi2.async.CollectionTask$DeleteMedia.task(CollectionTask.kt:1119)
E/AndroidRuntime( 6213): 	at com.ichi2.async.TaskDelegate.execTask(TaskDelegate.kt:50)
E/AndroidRuntime( 6213): 	at com.ichi2.async.CollectionTask.actualDoInBackground(CollectionTask.kt:136)
E/AndroidRuntime( 6213): 	at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.kt:98)
E/AndroidRuntime( 6213): 	at com.ichi2.async.CollectionTask.doInBackground(CollectionTask.kt:64)
E/AndroidRuntime( 6213): 	at android.os.AsyncTask$2.call(AsyncTask.java:288)
E/AndroidRuntime( 6213): 	at java.util.concurrent.FutureTask.run(FutureTask.java:237)
E/AndroidRuntime( 6213): 	... 4 more
W/ActivityManager( 1497):   Force finishing activity com.ichi2.anki/.DeckPicker
W/ActivityManager( 1497):   Force finishing activity com.android.documentsui/.DocumentsActivity

Originally posted by @mikehardy in #11849 (comment)

@mikehardy
Copy link
Member Author

Confirmed fixed with the new commit on #11849 - thanks!

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

Successfully merging a pull request may close this issue.

1 participant