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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] FileNotFoundException when addBitmapToCache #126

Closed
bucker opened this issue Apr 12, 2024 · 3 comments
Closed

[BUG] FileNotFoundException when addBitmapToCache #126

bucker opened this issue Apr 12, 2024 · 3 comments
Labels
bug Something isn't working Stale

Comments

@bucker
Copy link

bucker commented Apr 12, 2024

馃摑 Describe the Bug

I found the crash report looks like this:

java.io.FileNotFoundException: /data/user/0/com.myapp.www/cache/___pdf___cache___/0: open failed: ENOENT (No such file or directory)
at libcore.io.IoBridge.open(IoBridge.java:574)
at java.io.FileOutputStream.<init>(FileOutputStream.java:236)
at java.io.FileOutputStream.<init>(FileOutputStream.java:186)
at com.rajat.pdfviewer.util.CacheManager$addBitmapToCache$1.invokeSuspend(CacheManager.java:52)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:8)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(BaseContinuationImpl.java:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.java:108)
at kotlinx.coroutines.internal.LimitedDispatcher$Worker.run(LimitedDispatcher.java:115)
at com.google.android.play.core.tasks.zzc.run(zzc.java)
at kotlinx.coroutines.scheduling.TaskImpl.run(TaskImpl.java:103)
at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.java:584)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask(CoroutineScheduler.java:793)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker(CoroutineScheduler.java:697)
at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.java:684)
	
Suppressed: P9.i: [v0{Cancelling}@59bb3e6, Dispatchers.IO]
Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory)
at libcore.io.Linux.open(Native Method)
at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:274)
at libcore.io.ForwardingOs.open(ForwardingOs.java:563)
at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:8781)
at libcore.io.IoBridge.open(IoBridge.java:560)

Unable to reproduce it, but seems like it would be possible to access the cache folder /___pdf___cache___ cache has been deleteRecursively().

Since the task to add bitmap to cache will be run on the IO thread, there's no guarantee that the cacheDir will exist when it executes.

The solution might be to check the cacheDir exists before proceeding, but not sure if I have missed anything.

馃摉 Library Version

  • 2.1.1
@bucker bucker added the bug Something isn't working label Apr 12, 2024
Copy link

Thank you for creating your first issue. We appreciate your help in making this project better. We will look into it, and get back to you soon. Need help or want to discuss this issue? Join our Discord community here to ask questions and discuss this issue live!

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label May 13, 2024
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Stale
Projects
None yet
Development

No branches or pull requests

1 participant