You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when i use glide,i have some problem to display bitmap.i saw the source code and found that the loaddata method is ok,but cache failed and loadFromCache return null.
privateResource<T> cacheAndDecodeSourceData(Adata) throwsIOException {
longstartTime = LogTime.getLogTime();
SourceWriter<A> writer = newSourceWriter<A>(loadProvider.getSourceEncoder(), data);
diskCacheProvider.getDiskCache().put(resultKey.getOriginalKey(), writer);
if (Log.isLoggable(TAG, Log.VERBOSE)) {
logWithTimeAndKey("Wrote source to cache", startTime);
}
startTime = LogTime.getLogTime();
Resource<T> result = loadFromCache(resultKey.getOriginalKey());
if (Log.isLoggable(TAG, Log.VERBOSE) && result != null) {
logWithTimeAndKey("Decoded source from cache", startTime);
}
returnresult;
}
the log is below:
12-29 15:58:49.551 9289-9422/? V/DecodeJob: Decoded transformed from cache in 0.5225, key: EngineKey{http://b1.hucdn.com/upload/show/1512/07/53440550730659_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.551 9289-9422/? V/DecodeJob: Transcoded transformed from cache in 0.06958299999999999, key: EngineKey{http://b1.hucdn.com/upload/show/1512/07/53440550730659_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.551 9289-9422/? V/DecodeJob: Decoded source from cache in 0.43432299999999996, key: EngineKey{http://b1.hucdn.com/upload/show/1512/07/53440550730659_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.551 9289-9422/? V/DecodeJob: Transformed resource from source in 0.055364, key: EngineKey{http://b1.hucdn.com/upload/show/1512/07/53440550730659_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.551 9289-9422/? V/DecodeJob: Transcoded transformed from source in 0.236563, key: EngineKey{http://b1.hucdn.com/upload/show/1512/07/53440550730659_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.551 9289-9289/? V/GenericRequest: Got onSizeReady in 0.065417 this: 1167623000
12-29 15:58:49.551 9289-9289/? V/GenericRequest: finished setup for calling load in 0.39494799999999997 this: 1167623000
12-29 15:58:49.551 9289-9289/? V/GenericRequest: Resource ready in 1.48099 size: 0.03662109375 fromCache: true this: 1167623000
12-29 15:58:49.551 9289-9289/? V/Engine: Loaded resource from active resources in 1.0822399999999999ms, key: EngineKey{http://s0.husor.cn/image/app/img_mj_icon.jpg+com.bumptech.glide.f.b@43199d08+[33x33]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.551 9289-9289/? V/GenericRequest: finished onSizeReady in 2.30651 this: 1167623000
12-29 15:58:49.551 9289-9289/? V/GenericRequest: finished run method in 2.5901039999999997 this: 1167623000
12-29 15:58:49.561 9289-9453/? V/DecodeJob: Fetched data in 98.300782, key: EngineKey{http://b1.hucdn.com/upload/show/1512/28/88559748030011_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.561 9289-9453/? D/DecodeJob: Failed to find file to write to disk cache
java.io.FileNotFoundException: /storage/emulated/0/Android/data/com.husor.beibei/cache/glide/5a636e024b98a2b723472865a2690a9ac38f38a5a77dba9e51d2688b17cba8ee.0.tmp: open failed: EBUSY (Device or resource busy)
at libcore.io.IoBridge.open(IoBridge.java:409)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
at com.bumptech.glide.load.engine.c.a(DecodeJob.java:294)
at com.bumptech.glide.load.engine.d.a(DecodeJob.java:269)
at com.bumptech.glide.load.engine.a.j.a(DiskLruCacheWrapper.java:98)
at com.bumptech.glide.load.engine.a.b(DecodeJob.java:201)
at com.bumptech.glide.load.engine.a.a(DecodeJob.java:187)
at com.bumptech.glide.load.engine.a.e(DecodeJob.java:177)
at com.bumptech.glide.load.engine.a.c(DecodeJob.java:128)
at com.bumptech.glide.load.engine.EngineRunnable.f(EngineRunnable.java:122)
at com.bumptech.glide.load.engine.EngineRunnable.d(EngineRunnable.java:101)
at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
at com.bumptech.glide.load.engine.executor.a$1.run(FifoPriorityThreadPoolExecutor.java:118)
Caused by: libcore.io.ErrnoException: open failed: EBUSY (Device or resource busy)
at libcore.io.Posix.open(Native Method)
at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
at libcore.io.IoBridge.open(IoBridge.java:393)
at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
at com.bumptech.glide.load.engine.c.a(DecodeJob.java:294)
at com.bumptech.glide.load.engine.d.a(DecodeJob.java:269)
at com.bumptech.glide.load.engine.a.j.a(DiskLruCacheWrapper.java:98)
at com.bumptech.glide.load.engine.a.b(DecodeJob.java:201)
at com.bumptech.glide.load.engine.a.a(DecodeJob.java:187)
at com.bumptech.glide.load.engine.a.e(DecodeJob.java:177)
at com.bumptech.glide.load.engine.a.c(DecodeJob.java:128)
at com.bumptech.glide.load.engine.EngineRunnable.f(EngineRunnable.java:122)
at com.bumptech.glide.load.engine.EngineRunnable.d(EngineRunnable.java:101)
at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
at com.bumptech.glide.load.engine.executor.a$1.run(FifoPriorityThreadPoolExecutor.java:118)
12-29 15:58:49.561 9289-9453/? V/DecodeJob: Wrote source to cache in 5.031353, key: EngineKey{http://b1.hucdn.com/upload/show/1512/28/88559748030011_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.571 9289-9453/? V/DecodeJob: Transformed resource from source in 0.074219, key: EngineKey{http://b1.hucdn.com/upload/show/1512/28/88559748030011_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.571 9289-9453/? V/DecodeJob: Transcoded transformed from source in 0.059061999999999996, key: EngineKey{http://b1.hucdn.com/upload/show/1512/28/88559748030011_640x300.jpg!640x300.jpg+com.bumptech.glide.f.b@43199d08+[1080x506]+''+'ImageVideoBitmapDecoder.com.bumptech.glide.load.resource.bitmap'+''+'BitmapEncoder.com.bumptech.glide.load.resource.bitmap'+''+''}
12-29 15:58:49.601 9289-9289/? D/GenericRequest: load failed
The text was updated successfully, but these errors were encountered:
The logging is just for timings, it logs even if there's no resource being passed around, which may be misleading. notice that getDiskCache().put failed just before, so there's nothing to decode. Try to deobfuscate the stack trace to see. I don't think we can do much about this inside Glide, take a look at this: http://stackoverflow.com/q/11539657/253468
after that happens(Device or resource busy) .the loadData method is called and return resource data is ok and cache failed.
then we have to load the data from cache data, and return null。it wastes a lot of data traffic,but display nothing.
why not just cache it and then decode it from resource data? my glide version is 3.6.1
Because caching is not expected to fail, and it doesn't seem to 99.9999999% of the time. Remember that the type A here is an InputStream. Imagine if Glide spends a minute struggling to get a few megabytes sized image on a 3G network and writes it to cache. In that case: would you want to:
rewind the network stream,
(usually not possible, buffer is too small)
make a new network request for the same resource,
(wasteful and extremely slow)
or decode the cached File from the fast disk?
(our choice; "fast" compared to network traffic)
If you want to decode straight from the network, don't use .diskCacheStrategy(SOURCE|ALL).
when i use glide,i have some problem to display bitmap.i saw the source code and found that the loaddata method is ok,but cache failed and loadFromCache return null.
the log is below:
The text was updated successfully, but these errors were encountered: