The browser deletes the browsing data or displays an error if it fails to do this.
The browser crashes with the following stacktrace:
84fa9603-a48c-4cdd-8b15-04a9d1b68084
java.io.IOException: not a readable directory: /data/user/0/org.mozilla.fenix/cache/mozac_browser_thumbnails/thumbnails
java.io.IOException: not a readable directory: /data/user/0/org.mozilla.fenix/cache/mozac_browser_thumbnails/thumbnails
at com.jakewharton.disklrucache.Util.deleteContents(Util.java:7)
at com.jakewharton.disklrucache.DiskLruCache.delete(DiskLruCache.java:2)
at mozilla.components.browser.thumbnails.utils.ThumbnailDiskCache.clear$browser_thumbnails_release(ThumbnailDiskCache.kt:2)
at mozilla.components.browser.thumbnails.storage.ThumbnailStorage$clearThumbnails$1.invokeSuspend(ThumbnailStorage.kt:4)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:21)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
I'm not sure what we could do about this besides catch the exception if we have to race the user to delete the thumbnail cache before they delete all the app caches right after.
I walked through the code and we're locking our mutex when we call the LRU cache.
The issue only occurs when first clearing the cached data via the OS and then quickly using Fenix to delete the thumbnail cache. I guess the OS still has a lock on the data. If I wait long enough after starting the OS cached data clearing procedure, I do not get a crash by Fenix. I only included the first STR step to demonstrate that this does not need to be a large number of files/thumbnails, at least on my device.
That makes sense. It sounds like deleting the thumbnails where each one is multiple MB large can take a while and we're trying to then delete a directory that has already been deleted.
Catching this exception is probably the safest way forward since there isn't anything else we need to do to ensure a clean state.
Thanks for filling the issue and the context, much appreciated!
I don't see this exception any more in nightly. Closing for now as it rides the trains.
@jonalmeida I can still reproduce on Nightly 201216 17:01 (Build #2015781769) on the same device and using the same STR as the original report, see the following crash report:
java.io.IOException: not a readable directory: /data/user/0/org.mozilla.fenix/cache/mozac_browser_icons/resources
* Sentry: https://sentry.prod.mozaws.net/operations/fenix/?query=c95e01518d404b1ca38f2636d654e8f2
* Socorro: https://crash-stats.mozilla.org/report/index/bp-cf7ad22a-4053-4add-a84e-8ba720201217
----
java.io.IOException: not a readable directory: /data/user/0/org.mozilla.fenix/cache/mozac_browser_icons/resources
at com.jakewharton.disklrucache.Util.deleteContents(Util.java:7)
at com.jakewharton.disklrucache.DiskLruCache.delete(DiskLruCache.java:2)
at mozilla.components.browser.icons.utils.IconDiskCache.clear$browser_icons_release(IconDiskCache.kt:1)
at mozilla.components.browser.icons.BrowserIcons.clear(BrowserIcons.kt:1)
at org.mozilla.fenix.settings.deletebrowsingdata.DefaultDeleteBrowsingDataController$deleteBrowsingData$2.invokeSuspend(DeleteBrowsingDataController.kt:10)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:3)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:15)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
This looks like a similar crash but for a browser-icons.
My patch was only for the thumbnails storage. I think we can easily copy it over there though. If you could file a new ticket for that, it would be helpful, otherwise I'll get to it soon.
Thanks for reporting back! ๐
This looks like a similar crash but for a browser-icons.
You are totally right, that is a different stacktrace message.
My patch was only for the thumbnails storage. I think we can easily copy it over there though. If you could file a new ticket for that, it would be helpful, otherwise I'll get to it soon.
I have opened #17103 (now https://github.com/mozilla-mobile/android-components/issues/9269) to track this in the Fenix repository. I hope that is what you meant, I could also have opened an AC issue for this ๐
No worries, this works. Thank you!