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

Only call ExifInterface on RAW/JPEG image formats. #3851

Closed
ZacSweers opened this issue Aug 24, 2019 · 31 comments
Closed

Only call ExifInterface on RAW/JPEG image formats. #3851

ZacSweers opened this issue Aug 24, 2019 · 31 comments

Comments

@ZacSweers
Copy link

This file yields the following error trace from glide, even though it is rendered correctly. This suggests to me that it's either a noisy logger that should be configurable/suppressed or it should have more information as to what the consequences are of this

https://avatars3.githubusercontent.com/u/698437?v=4

2019-08-24 19:00:13.436 31864-32083/io.sweers.catchup.debug W/ExifInterface: Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
    java.io.IOException: Invalid byte order: ffff8950
        at android.media.ExifInterface.readByteOrder(ExifInterface.java:3121)
        at android.media.ExifInterface.isOrfFormat(ExifInterface.java:2437)
        at android.media.ExifInterface.getMimeType(ExifInterface.java:2315)
        at android.media.ExifInterface.loadAttributes(ExifInterface.java:1753)
        at android.media.ExifInterface.<init>(ExifInterface.java:1447)
        at com.bumptech.glide.load.resource.bitmap.ExifInterfaceImageHeaderParser.getOrientation(ExifInterfaceImageHeaderParser.java:40)
        at com.bumptech.glide.load.ImageHeaderParserUtils.getOrientation(ImageHeaderParserUtils.java:91)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeFromWrappedStreams(Downsampler.java:236)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:206)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:162)
        at com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder.decode(ByteBufferBitmapDecoder.java:33)
        at com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder.decode(ByteBufferBitmapDecoder.java:16)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:72)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:55)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:45)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:58)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:43)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:515)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:480)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:466)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:418)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:387)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataFetcherReady(SourceGenerator.java:135)
        at com.bumptech.glide.load.engine.DataCacheGenerator.onDataReady(DataCacheGenerator.java:95)
        at com.bumptech.glide.load.model.ByteBufferFileLoader$ByteBufferFetcher.loadData(ByteBufferFileLoader.java:74)
        at com.bumptech.glide.load.engine.DataCacheGenerator.startNext(DataCacheGenerator.java:75)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:49)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:309)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)
@ZacSweers
Copy link
Author

This might be something specific to Android Q betas, trying to get clarification

@sjudd
Copy link
Collaborator

sjudd commented Aug 27, 2019

Probably the same as #3383, unfortunately we can't control what they log.

We might be able to avoid calling the support library for pngs though.

@sjudd sjudd changed the title Invalid image: ExifInterface got an unsupported image format Only call ExifInterface on RAW/JPEG image formats. Aug 27, 2019
@ZacSweers
Copy link
Author

What about possibly using the Exif support library?

@krcho
Copy link

krcho commented Sep 2, 2019

I try to use support library exif,
but it don't work

I'm using AVD (API 29)

@okarakose
Copy link

okarakose commented Sep 2, 2019

I am getting the noisy logs as well. Photos are loading normally.

OS API : 28
Exif Library Version : AndroidX 1.1.0-beta01
Glide Version : 4.9.0

Logs are below :

2019-09-02 11:20:58.365 D/Glide: Finished loading Bitmap from REMOTE for https://images.unsplash.com/photo-1565796703342-bd5b133692d0 with size [1080x1920] in 2764.847238 ms
2019-09-02 11:20:59.660 W/ExifInterface: Skip the tag entry since tag number is not defined: 34864
2019-09-02 11:20:59.660 W/ExifInterface: Skip the tag entry since tag number is not defined: 36880
2019-09-02 11:20:59.662 W/ExifInterface: Skip the tag entry since tag number is not defined: 42033
2019-09-02 11:20:59.663 W/ExifInterface: Skip the tag entry since tag number is not defined: 42034
2019-09-02 11:20:59.663 W/ExifInterface: Skip the tag entry since tag number is not defined: 42036
2019-09-02 11:20:59.663 W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2019-09-02 11:20:59.664 W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2019-09-02 11:21:00.536 D/Glide: Finished loading Bitmap from REMOTE for https://images.unsplash.com/photo-1565840620394-13bf50ca76d6 with size [1080x1920] in 4870.6866119999995 ms
2019-09-02 11:21:00.616 D/Glide: Finished loading Bitmap from REMOTE for https://images.unsplash.com/photo-1566786859182-13583eb0e6b9 with size [1080x1920] in 4883.615311 ms
2019-09-02 11:21:02.105 W/ExifInterface: Skip the tag entry since tag number is not defined: 34864
2019-09-02 11:21:02.105 W/ExifInterface: Skip the tag entry since tag number is not defined: 34866
2019-09-02 11:21:02.108 W/ExifInterface: Skip the tag entry since tag number is not defined: 42034
2019-09-02 11:21:02.108 W/ExifInterface: Skip the tag entry since tag number is not defined: 42036
2019-09-02 11:21:02.108 W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2019-09-02 11:21:02.109 W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2019-09-02 11:21:02.849 D/Glide: Finished loading Bitmap from REMOTE for https://images.unsplash.com/photo-1566508416487-343301d6f4e9 with size [1080x1920] in 7099.460102 ms
2019-09-02 11:21:04.730 W/ExifInterface: Skip the tag entry since tag number is not defined: 34864
2019-09-02 11:21:04.733 W/ExifInterface: Skip the tag entry since tag number is not defined: 42033
2019-09-02 11:21:04.733 W/ExifInterface: Skip the tag entry since tag number is not defined: 42034
2019-09-02 11:21:04.733 W/ExifInterface: Skip the tag entry since tag number is not defined: 42035
2019-09-02 11:21:04.733 W/ExifInterface: Skip the tag entry since tag number is not defined: 42036
2019-09-02 11:21:04.734 W/ExifInterface: Skip the tag entry since tag number is not defined: 42037
2019-09-02 11:21:04.734 W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2019-09-02 11:21:04.734 W/ExifInterface: Stop reading file since a wrong offset may cause an infinite loop: 0
2019-09-02 11:21:05.722 D/Glide: Finished loading Bitmap from REMOTE for https://images.unsplash.com/photo-1565608038989-24b797abaa45 with size [1080x1920] in 9924.717236 ms

Any plan to fix this soon ?

@c0dehunter
Copy link

Happy to jump in with bug report. Running on Android Q AVD (Pixel 3). Sad to say I am now unable to reproduce this, I guess the image has changed (we re-generate it on server every minute). If it happens again, I will attach it. Here is another one, but it works fine:

image

Log:

2019-09-13 22:38:59.163 7184-7810/com.my.app W/ExifInterface: Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
    java.io.IOException: Invalid byte order: ffff8950
        at android.media.ExifInterface.readByteOrder(ExifInterface.java:3121)
        at android.media.ExifInterface.isOrfFormat(ExifInterface.java:2437)
        at android.media.ExifInterface.getMimeType(ExifInterface.java:2315)
        at android.media.ExifInterface.loadAttributes(ExifInterface.java:1753)
        at android.media.ExifInterface.<init>(ExifInterface.java:1447)
        at com.bumptech.glide.load.resource.bitmap.ExifInterfaceImageHeaderParser.getOrientation(ExifInterfaceImageHeaderParser.java:40)
        at com.bumptech.glide.load.ImageHeaderParserUtils.getOrientation(ImageHeaderParserUtils.java:91)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeFromWrappedStreams(Downsampler.java:236)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:206)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:162)
        at com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder.decode(ByteBufferBitmapDecoder.java:33)
        at com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder.decode(ByteBufferBitmapDecoder.java:16)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:72)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:55)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:45)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:58)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:43)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:515)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:480)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:466)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:418)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:387)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataFetcherReady(SourceGenerator.java:135)
        at com.bumptech.glide.load.engine.DataCacheGenerator.onDataReady(DataCacheGenerator.java:95)
        at com.bumptech.glide.load.model.ByteBufferFileLoader$ByteBufferFetcher.loadData(ByteBufferFileLoader.java:74)
        at com.bumptech.glide.load.engine.DataCacheGenerator.startNext(DataCacheGenerator.java:75)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:49)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:309)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:235)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:919)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:446)

@Dararii
Copy link

Dararii commented Sep 20, 2019

same issue here. Is that possibly cause a bug in some devices?

@strajky5
Copy link

Same here Pixel 2XL, Android 10.

@joerogers
Copy link

I see a few options:

  1. Do not extract EXIF data on png images which for me is the main issue.
  2. Update ImageHeaderParserUtils.java to "catch" any exception and continue on to the next header parser with minimal or no logging.
    //noinspection ForLoopReplaceableByForEach to improve perf
    for (int i = 0, size = parsers.size(); i < size; i++) {
      ImageHeaderParser parser = parsers.get(i);
      try {
        int orientation = parser.getOrientation(is, byteArrayPool);
        if (orientation != ImageHeaderParser.UNKNOWN_ORIENTATION) {
          return orientation;
        }
      } catch(Throwable e) {
         // Move to next parser if an exception occurs
         continue;
      } finally {
        is.reset();
      }
    }
   return ImageHeaderParser.UNKNOWN_ORIENTATION;

@davelogan
Copy link

I am seeing the same issue.
Google Pixel2 XL running Android Q

implementation 'com.github.bumptech.glide:glide:4.9.0'
kapt 'com.github.bumptech.glide:compiler:4.9.0'

@eygraber
Copy link

Still happening on 4.10.0

@hoanghiephui
Copy link

same issue here

@wankey
Copy link

wankey commented Nov 1, 2019

happened on Oneplus 7 pro(Android10)

glide-copybara-robot pushed a commit that referenced this issue Nov 1, 2019
glide-copybara-robot pushed a commit that referenced this issue Nov 1, 2019
glide-copybara-robot pushed a commit that referenced this issue Nov 5, 2019
@crossle
Copy link

crossle commented Nov 6, 2019

When release this?

@ktl-111
Copy link

ktl-111 commented Nov 11, 2019

Are you using " new DrawableCrossFadeFactory.Builder(300).setCrossFadeEnabled(true).build()"? If you delete this, there is no problem, I don't know if it is caused by this.

@nicusorflorin
Copy link

@sjudd when can we expect this to hit release? thanks

@fenghebaiyang
Copy link

fenghebaiyang commented Nov 18, 2019

same issues on Xiao Mi 8 (On android 10)
implementation 'com.github.bumptech.glide:glide:4.9.0' annotationProcessor 'com.github.bumptech.glide:compiler:4.9.0'

@maheshordex
Copy link

Same issues on Pixel3a Android Q simulator.

@leokwsw
Copy link

leokwsw commented Dec 9, 2019

same issue on Google Pixel 2 On Android 10
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

@anupmcommu
Copy link

same issue... is there any alternative for this problem ?

@alexatbooli
Copy link

Well I removed Glide over this issue - didnt really enjoy the logs being chock full of stack traces.

@Firsto
Copy link

Firsto commented Dec 17, 2019

all images are loaded, but I got a lot of useless text in logcat - can I disable it without changing image library to picasso ????

@thizisarun
Copy link

Same Issue for me also. But if i remove Requestoptions then there is no exception log.Why?

@Dimon70007
Copy link

I have changed

 .diskCacheStrategy(DiskCacheStrategy.RESOURCE)

to

 .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC)

and got successfully decoded image instead of crash

@perracodex
Copy link

perracodex commented Dec 23, 2019

Take into account that ExifInterface 1.2.0-beta01 (androidx support library), adds support for WebP and PNG files, so instead of placing a RAW/JPEG exif filtering in Glide, probably would be better to wait for the next ExifInterface stable release.

https://developer.android.com/jetpack/androidx/releases/exifinterface#1.2.0-beta01

@luohaohaha
Copy link

same issue on Pixel 2(Android 10)
implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

@m4xp1
Copy link

m4xp1 commented Jan 8, 2020

Why issue closed? I still have same problem ((

implementation 'com.github.bumptech.glide:glide:4.10.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.10.0'

@tarik-git
Copy link

glideRequests.load(URI).into(imageView);

Why has this issue been closed. I still receive these errors on Android 10, and only on Android 10. Not only do i receive these annoying log messages but I load a lot of images and videos, and on Android 10, it is very slow. I tested this on a Pixel 1 device with Android 9, the images and videos were loading fast, when I updated the device to Android 10, with no change to the code the device started writing these logs and loading image and video thumbnails very slow.

@baruchn
Copy link

baruchn commented Jan 13, 2020

I also receive these errors on Android 10. This issue should definitely be reopened.

@c0dehunter
Copy link

Please reopen and fix, it's a major problem with Android 10!

@sjudd
Copy link
Collaborator

sjudd commented Jan 13, 2020

Glide 4.11 and onwards use the support library, but on android 10 you may still see these logs from other applications or the framework itself attempting to parse exif data

For more information on exif redaction which may cause these logs and/or impact performance, see: https://developer.android.com/training/data-storage/shared/media#location-info-photos.

If anyone sees Glide 4.11 or higher producing these logs, please file a new issue. I'm going to lock this one to reduce the noise.

@bumptech bumptech locked as resolved and limited conversation to collaborators Jan 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests