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

FileNotFoundException crashes app #99

Closed
savvasdalkitsis opened this issue Aug 29, 2024 · 6 comments
Closed

FileNotFoundException crashes app #99

savvasdalkitsis opened this issue Aug 29, 2024 · 6 comments

Comments

@savvasdalkitsis
Copy link

savvasdalkitsis commented Aug 29, 2024

I am getting a couple of crashes in UhuruPhotos (savvasdalkitsis/uhuruphotos-android#976) relating to telephoto. I believe the cause issue could be that the app somehow thinks there is a local media file on disk to display and it tries to load it with telephoto, so there is something to be fixed there for sure but I still think that perhaps the library shouldn't crash when the file it tries to load is missing but perhaps handle it more graciously?

Thoughts?

java.io.FileNotFoundException · java.io.FileNotFoundException: No item at content://media/external/images/media/1000251914
RawDatabaseUtils.java:151
android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcelContentProviderNative.java:814
android.content.ContentProviderProxy.openTypedAssetFileContentResolver.java:2043
android.content.ContentResolver.openTypedAssetFileDescriptorContentResolver.java:1858
android.content.ContentResolver.openAssetFileDescriptorContentResolver.java:1528
android.content.ContentResolver.openInputStreamSubSamplingImageSource.kt:213
me.saket.telephoto.subsamplingimage.UriImageSource.peeksubSamplingEligibility.kt:47
me.saket.telephoto.zoomable.coil.SubSamplingEligibilityKt.canBeSubSampledsubSamplingEligibility.kt:1
me.saket.telephoto.zoomable.coil.SubSamplingEligibilityKt.access$canBeSubSampledsubSamplingEligibility.kt:27
me.saket.telephoto.zoomable.coil.SubSamplingEligibilityKt$canBeSubSampled$2.invokeSuspendContinuationImpl.kt:33
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWithDispatchedTask.kt:104
kotlinx.coroutines.DispatchedTask.run
@saket
Copy link
Owner

saket commented Sep 1, 2024

Oh yea, I think I'm incorrectly assuming that content Uris will always be available. I'll fix this once I'm back home in a few days.

// Possible reasons for reaching this code path:
// - Locally stored images such as assets, resource, etc.
// - Remote image that wasn't saved to disk because of a "no-store" HTTP header.
result.request.mapRequestDataToUriOrNull()?.let { uri ->
SubSamplingImageSource.contentUriOrNull(uri, preview)
}

saket added a commit that referenced this issue Sep 13, 2024
@saket
Copy link
Owner

saket commented Sep 13, 2024

I’m back at my computer today and was able to reproduce the issue, but only under specific conditions: when the image has been deleted from the disk but remains in Coil’s memory cache. Could this be what’s happening with your users?

Regression test: dd794df#diff-fc5fbc64d3d34d4b964b17bcdc367ce908897e49ae96a394ac9bd5f7957cb193

@savvasdalkitsis
Copy link
Author

Possibly. this doesn't happen frequently so i have no way to check tbh.

@EvgenyMeltsaykin
Copy link

@saket Hi! I have this happen all the time on my work project. It doesn't happen on all devices, but I can replicate it on a Galaxy A6+ I can check the snapshot version with the fix if you can provide it to me

@saket
Copy link
Owner

saket commented Sep 19, 2024

@EvgenyMeltsaykin that'd be super helpful. Can you try out 0.14.0-SNAPSHOT?

@saket
Copy link
Owner

saket commented Nov 13, 2024

0.14.0 is out with a fix: https://github.com/saket/telephoto/releases/tag/0.14.0. Please let me know if you continue seeing these crashes?

@saket saket closed this as completed Nov 13, 2024
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

No branches or pull requests

3 participants