bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.62k stars 6.12k forks source link

It load image failed when I use 'DiskCacheStrategy.RESOURCE' mode. #4736

Open qianshui423 opened 2 years ago

qianshui423 commented 2 years ago

Glide Version:4.11.0

Integration libraries:okhttp 4.8.0、okio 2.7.0

Device/Android Version:Xiaomi 10 Pro/Android 11

Issue details / Repro steps / Use case background: It load image failed when I use 'DiskCacheStrategy.RESOURCE' mode.

Glide load line / GlideModule (if any) / list Adapter code (if any):

Glide.with(fragment).load(imageUrl)
                    .diskCacheStrategy(DiskCacheStrategy.RESOURCE)
                    .into(imageView);

Layout XML:

<ImageView
                android:id="@+id/iv_sample"
                android:layout_width="194dp"
                android:layout_height="33dp"
                android:scaleType="fitXY" />

Stack trace / LogCat:

2022-01-28 16:40:50.822 14062-14062/com.xxx W/Glide: Load failed for https://xxx.png with size [1080x127]
    class com.bumptech.glide.load.engine.GlideException: Failed to load resource
    There were 5 causes:
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
     call GlideException#logRootCauses(String) for more detail
      Cause (1 of 1): class com.bumptech.glide.load.engine.GlideException: Failed LoadPath{ContentLengthInputStream->Object->Drawable}, REMOTE
    There were 5 causes:
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
     call GlideException#logRootCauses(String) for more detail
        Cause (1 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ContentLengthInputStream->Drawable->Drawable}
    There were 2 causes:
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 2): class java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
          Cause (2 of 2): class java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        Cause (2 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ContentLengthInputStream->GifDrawable->Drawable}
    There was 1 cause:
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        Cause (3 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ContentLengthInputStream->Bitmap->Drawable}
    There was 1 cause:
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        Cause (4 of 4): class com.bumptech.glide.load.engine.GlideException: Failed DecodePath{ContentLengthInputStream->BitmapDrawable->Drawable}
    There was 1 cause:
    java.io.IOException(Failed to read all expected data, expected: 65815, but read: 23796)
     call GlideException#logRootCauses(String) for more detail
          Cause (1 of 1): class java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
2022-01-28 16:40:50.822 14062-14062/com.xxx I/Glide: Root cause (1 of 5)
    java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        at com.bumptech.glide.util.ContentLengthInputStream.checkReadSoFarOrThrow(ContentLengthInputStream.java:78)
        at com.bumptech.glide.util.ContentLengthInputStream.read(ContentLengthInputStream.java:71)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:230)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser$StreamReader.getUInt8(DefaultImageHeaderParser.java:506)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser$StreamReader.getUInt16(DefaultImageHeaderParser.java:516)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser.getType(DefaultImageHeaderParser.java:89)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser.getType(DefaultImageHeaderParser.java:61)
        at com.bumptech.glide.load.ImageHeaderParserUtils$1.getType(ImageHeaderParserUtils.java:48)
        at com.bumptech.glide.load.ImageHeaderParserUtils.getTypeInternal(ImageHeaderParserUtils.java:117)
        at com.bumptech.glide.load.ImageHeaderParserUtils.getType(ImageHeaderParserUtils.java:42)
        at com.bumptech.glide.load.resource.gif.StreamGifDecoder.handles(StreamGifDecoder.java:42)
        at com.bumptech.glide.load.resource.gif.StreamGifDecoder.handles(StreamGifDecoder.java:23)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:90)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:524)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:488)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:474)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:426)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:390)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:148)
        at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:76)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:57)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
        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:923)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
2022-01-28 16:40:50.823 14062-14062/com.xxx I/Glide: Root cause (2 of 5)
    java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        at com.bumptech.glide.util.ContentLengthInputStream.checkReadSoFarOrThrow(ContentLengthInputStream.java:78)
        at com.bumptech.glide.util.ContentLengthInputStream.read(ContentLengthInputStream.java:71)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:305)
        at com.bumptech.glide.util.ExceptionCatchingInputStream.read(ExceptionCatchingInputStream.java:88)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at com.bumptech.glide.util.MarkEnforcingInputStream.read(MarkEnforcingInputStream.java:46)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:305)
        at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
        at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:790)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:765)
        at com.bumptech.glide.load.resource.bitmap.ImageReader$InputStreamImageReader.decodeBitmap(ImageReader.java:50)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeStream(Downsampler.java:742)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeFromWrappedStreams(Downsampler.java:390)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:248)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:207)
        at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:62)
        at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:18)
        at com.bumptech.glide.load.resource.bitmap.BitmapDrawableDecoder.decode(BitmapDrawableDecoder.java:58)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:92)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:524)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:488)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:474)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:426)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:390)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:148)
        at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:76)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:57)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
        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:923)
2022-01-28 16:40:50.823 14062-14062/com.xxx I/Glide:     at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
2022-01-28 16:40:50.823 14062-14062/com.xxx I/Glide: Root cause (3 of 5)
    java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        at com.bumptech.glide.util.ContentLengthInputStream.checkReadSoFarOrThrow(ContentLengthInputStream.java:78)
        at com.bumptech.glide.util.ContentLengthInputStream.read(ContentLengthInputStream.java:71)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:230)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser$StreamReader.getUInt8(DefaultImageHeaderParser.java:506)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser$StreamReader.getUInt16(DefaultImageHeaderParser.java:516)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser.getType(DefaultImageHeaderParser.java:89)
        at com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser.getType(DefaultImageHeaderParser.java:61)
        at com.bumptech.glide.load.ImageHeaderParserUtils$1.getType(ImageHeaderParserUtils.java:48)
        at com.bumptech.glide.load.ImageHeaderParserUtils.getTypeInternal(ImageHeaderParserUtils.java:117)
        at com.bumptech.glide.load.ImageHeaderParserUtils.getType(ImageHeaderParserUtils.java:42)
        at com.bumptech.glide.load.resource.gif.StreamGifDecoder.handles(StreamGifDecoder.java:42)
        at com.bumptech.glide.load.resource.gif.StreamGifDecoder.handles(StreamGifDecoder.java:23)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:90)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:524)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:488)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:474)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:426)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:390)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:148)
        at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:76)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:57)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
        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:923)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
2022-01-28 16:40:50.823 14062-14062/com.xxx I/Glide: Root cause (4 of 5)
    java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        at com.bumptech.glide.util.ContentLengthInputStream.checkReadSoFarOrThrow(ContentLengthInputStream.java:78)
        at com.bumptech.glide.util.ContentLengthInputStream.read(ContentLengthInputStream.java:71)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:305)
        at com.bumptech.glide.util.ExceptionCatchingInputStream.read(ExceptionCatchingInputStream.java:88)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at com.bumptech.glide.util.MarkEnforcingInputStream.read(MarkEnforcingInputStream.java:46)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:305)
        at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
        at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:790)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:765)
        at com.bumptech.glide.load.resource.bitmap.ImageReader$InputStreamImageReader.decodeBitmap(ImageReader.java:50)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeStream(Downsampler.java:742)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeFromWrappedStreams(Downsampler.java:390)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:248)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:207)
        at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:62)
        at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:18)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:92)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:524)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:488)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:474)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:426)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:390)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:148)
        at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:76)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:57)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
        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:923)
        at com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.run(GlideExecutor.java:393)
2022-01-28 16:40:50.824 14062-14062/com.xxx I/Glide: Root cause (5 of 5)
    java.io.IOException: Failed to read all expected data, expected: 65815, but read: 23796
        at com.bumptech.glide.util.ContentLengthInputStream.checkReadSoFarOrThrow(ContentLengthInputStream.java:78)
        at com.bumptech.glide.util.ContentLengthInputStream.read(ContentLengthInputStream.java:71)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:305)
        at com.bumptech.glide.util.ExceptionCatchingInputStream.read(ExceptionCatchingInputStream.java:88)
        at java.io.FilterInputStream.read(FilterInputStream.java:133)
        at com.bumptech.glide.util.MarkEnforcingInputStream.read(MarkEnforcingInputStream.java:46)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:173)
        at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:305)
        at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
        at android.graphics.BitmapFactory.decodeStreamInternal(BitmapFactory.java:790)
        at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:765)
        at com.bumptech.glide.load.resource.bitmap.ImageReader$InputStreamImageReader.decodeBitmap(ImageReader.java:50)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeStream(Downsampler.java:742)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeFromWrappedStreams(Downsampler.java:390)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:248)
        at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:207)
        at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:62)
        at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:18)
        at com.bumptech.glide.load.resource.bitmap.BitmapDrawableDecoder.decode(BitmapDrawableDecoder.java:58)
        at com.bumptech.glide.load.engine.DecodePath.decodeResourceWithList(DecodePath.java:92)
        at com.bumptech.glide.load.engine.DecodePath.decodeResource(DecodePath.java:70)
        at com.bumptech.glide.load.engine.DecodePath.decode(DecodePath.java:59)
        at com.bumptech.glide.load.engine.LoadPath.loadWithExceptionList(LoadPath.java:76)
        at com.bumptech.glide.load.engine.LoadPath.load(LoadPath.java:57)
        at com.bumptech.glide.load.engine.DecodeJob.runLoadPath(DecodeJob.java:524)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromFetcher(DecodeJob.java:488)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromData(DecodeJob.java:474)
        at com.bumptech.glide.load.engine.DecodeJob.decodeFromRetrievedData(DecodeJob.java:426)
        at com.bumptech.glide.load.engine.DecodeJob.onDataFetcherReady(DecodeJob.java:390)
        at com.bumptech.glide.load.engine.SourceGenerator.onDataReadyInternal(SourceGenerator.java:148)
        at com.bumptech.glide.load.engine.SourceGenerator$1.onDataReady(SourceGenerator.java:76)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.onDataReady(MultiModelLoader.java:145)
        at com.bumptech.glide.load.data.HttpUrlFetcher.loadData(HttpUrlFetcher.java:57)
        at com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.loadData(MultiModelLoader.java:100)
        at com.bumptech.glide.load.engine.SourceGenerator.startNextLoad(SourceGenerator.java:70)
        at com.bumptech.glide.load.engine.SourceGenerator.startNext(SourceGenerator.java:63)
        at com.bumptech.glide.load.engine.DecodeJob.runGenerators(DecodeJob.java:310)
        at com.bumptech.glide.load.engine.DecodeJob.runWrapped(DecodeJob.java:279)
        at com.bumptech.glide.load.engine.DecodeJob.run(DecodeJob.java:234)
        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:923)
qianshui423 commented 2 years ago

I find RecyclableBufferedInputStream's skip() method has a bug while parameter byteCount > buffer's remain count. follow:

RecyclableBufferedInputStream class's 391 line, comment content: '// Couldn't get all the bytes, skip what we read.'

sjudd commented 2 years ago

I'd welcome a fix, or a sample project/unit test where I can reproduce this. It seems like the error must be deeper in in the stream, fillBuff is failing to read the required data?

Truvuongss commented 2 years ago

I got same issue. When change 'DiskCacheStrategy.RESOURCE' to 'DiskCacheStrategy.ALL' thIs issue not occur but it will make some side effect for my application. Please help to check this.