Image Loading Failure: Mark has been invalidated Error when load png file which is bigger than 5MB, without diskCache
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
### Glide Version:
4.14.2
### Integration libraries:
com.github.bumptech.glide:Volley:4.14.2
### Device/Android Version:
API 31
### Issue details / Repro steps / Use case background:
It's similar issue with 4517 (https://github.com/bumptech/glide/issues/4517)
When you try to load 5MB png file(which size bigger than max buffer size in recycleablebufferedinputStream in Glide(5MB)) without Data Cache(Disk only cache resource), you fail load image
The cause of this problem is. when you try to get Orientation(in downsampler.java, 330 Line). it use ExifInterface and when ExifInterface Initialize, it read InputStream. And then the inputStream gets wrong.
before get Orientation, it can decode InputStream,

but It can't after ExifInterface read the inputStream.
If you use Data(not resource) Cache after fail all try to load image using inputStream, then it try to load image using file cached on disk(not using inputStream) So. it load image successfully. (In this case it doesn't use stream)
I think when the stream size is bigger than 5 MB it should return default Orientation -1(if it use ExifInterface)
The Error message is
```
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 4 root causes:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ByteArrayInputStream->Object->Drawable}, REMOTE
There were 4 root causes:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ByteArrayInputStream->Drawable->Drawable}
There was 1 root cause:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException: Mark has been invalidated, pos: 104557 markLimit: 5242880
Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ByteArrayInputStream->GifDrawable->Drawable}
There was 1 root cause:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException: Mark has been invalidated, pos: 104557 markLimit: 5242880
Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ByteArrayInputStream->Bitmap->BitmapDrawable}
There was 1 root cause:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException: Mark has been invalidated, pos: 104557 markLimit: 5242880
Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ByteArrayInputStream->BitmapDrawable->Drawable}
There was 1 root cause:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
Cause (1 of 1): class com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException: Mark has been invalidated, pos: 104557 markLimit: 5242880
2022-11-08 19:58:19.193 12813-12813/net.bucketplace E/ImgBoxUi: Load Failed : com.bumptech.glide.load.engine.GlideException: Failed to load resource
There were 4 root causes:
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream$InvalidMarkException(Mark has been invalidated, pos: 104557 markLimit: 5242880)
call GlideException#logRootCauses(String) for more detail
```
Contributor guide
Assessment
This issue has not been assessed yet.