Open he4330937 opened 6 years ago
Hi @he4330937,
It looks like you might not have included some important information when you filed this issue. To make sure we have all the information we need to help with your issue. Please take a look at the Issue Template and make sure you've filled out as many sections as possible.
In particular you must include:
I'm marking this issue as requiring more information. Please understand that if you do not provide that information or update the issue within the next 7 days this issue will be automatically closed so that it doesn''t clutter the bug tracker.
Best regards,
~ Your friendly GitIssueBot
PS: I'm just an automated script, not a human being.
Glide Version: 4.4
Integration libraries:
annotationProcessor 'com.github.bumptech.glide:compiler:4.4.0'
compile 'com.github.bumptech.glide:annotations:4.4.0'
compile 'com.github.bumptech.glide:gifdecoder:4.4.0'
compile 'com.github.bumptech.glide:disklrucache:4.4.0'
compile 'com.github.bumptech.glide:glide:4.4.0@aar'
Device/Android Version: 4.2.2 , 4.2.1
Issue details / Repro steps / Use case background:
We found some crash in 4.2.2 and 4.2.1 . Other os version is fine, We collect the log via network. We check log, it happens in the image processing. Use showImage() function to show image.
Glide load line / GlideModule (if any) / list Adapter code (if any):
public final class LiveGlideModule extends AppGlideModule{
@Override
public void applyOptions(Context context, GlideBuilder builder) {
MemorySizeCalculator calculator = new MemorySizeCalculator.Builder(context)
.setMemoryCacheScreens(1)
.build();
builder.setMemoryCache(new LruResourceCache(calculator.getMemoryCacheSize()));
builder.setBitmapPool(new LruBitmapPool(calculator.getBitmapPoolSize()));
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, context.getCacheDir().getAbsolutePath(), 50 * 1024 * 1024));
}
@Override
public boolean isManifestParsingEnabled() {
return false;
}
}
public static void showImage(final GlideRequests requestManager, final ImageView imageView,
final String url, final Integer defaultId,
final boolean isMemoryCache, final boolean isDiskCache,
final LoadImageListener l) {
if (requestManager == null || imageView == null) {
if (l != null) {
l.onFail();
}
return;
}
if (l != null) {
l.onLoadingStart();
}
imageView.post(new Runnable() {
@Override
public void run() {
final Bitmap bitmap = defaultId == null ? null
: BitmapUtils.getBitmap(imageView.getContext(), defaultId, imageView.getWidth(), imageView.getHeight());
final Drawable drawable = new BitmapDrawable(bitmap);
if (TextUtils.isEmpty(url)) {
imageView.setImageDrawable(drawable);
return;
}
requestManager.load(url)
// .skipMemoryCache(isMemoryCache ? false : true)
.skipMemoryCache(true)
// .diskCacheStrategy(isDiskCache ? DiskCacheStrategy.AUTOMATIC : DiskCacheStrategy.NONE)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.fitCenter()
.placeholder(drawable)
.error(drawable)
.listener(new RequestListener<Drawable>() {
@Override
public boolean onLoadFailed(@Nullable GlideException e, Object model, Target<Drawable> target, boolean isFirstResource) {
if (l != null) {
l.onFail();
}
return true;
}
@Override
public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
boolean result = false;
if (l != null) {
result = l.onSuccess();
}
return result;
}
}).into(imageView);
}
});
imageView.setVisibility(View.VISIBLE);
}
Stack trace / LogCat:
1 #00 pc 000b1c54 /system/lib/libskia.so [armeabi-v7a]
2 #1 pc 000b39e8 /system/lib/libskia.so (SkPNGImageEncoder::doEncode(SkWStream*, SkBitmap const&, bool const&, int, int, SkBitmap::Config, png_color_8_struct&)+456) [armeabi-v7a]
3 #2 pc 000b3da4 /system/lib/libskia.so (SkPNGImageEncoder::onEncode(SkWStream*, SkBitmap const&, int)+328) [armeabi-v7a]
4 #3 pc 000b5228 /system/lib/libskia.so (SkImageEncoder::encodeStream(SkWStream*, SkBitmap const&, int)+32) [armeabi-v7a]
5 #4 pc 0006a659 /system/lib/libandroid_runtime.so [armeabi-v7a]
6 #5 pc 0001e290 /system/lib/libdvm.so (dvmPlatformInvoke+112) [armeabi-v7a]
7 #6 pc 0004d359 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+396) [armeabi-v7a]
8 #7 pc 00038bdd /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+8) [armeabi-v7a]
9 #8 pc 000276a0 /system/lib/libdvm.so [armeabi-v7a]
10 #9 pc 0002b57c /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184) [armeabi-v7a]
11 #10 pc 0005fb79 /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+272) [armeabi-v7a]
12 #11 pc 0005fba3 /system/lib/libdvm.so (dvmCallMethod(Thread*, Method const*, Object*, JValue*, ...)+20) [armeabi-v7a]
13 #12 pc 0005471f /system/lib/libdvm.so [armeabi-v7a]
14 #13 pc 0000e3d8 /system/lib/libc.so (__thread_entry+72) [armeabi-v7a]
15 #14 pc 0000dac4 /system/lib/libc.so (pthread_create+160) [armeabi-v7a]
16 java:
17 android.graphics.Bitmap.nativeCompress(Native Method)
18 android.graphics.Bitmap.compress(Bitmap.java:875)
19 com.bumptech.glide.load.resource.bitmap.BitmapEncoder.boolean encode(com.bumptech.glide.load.engine.Resource,java.io.File,com.bumptech.glide.load.Options)(SourceFile:66)
20 com.bumptech.glide.load.resource.bitmap.BitmapEncoder.boolean encode(java.lang.Object,java.io.File,com.bumptech.glide.load.Options)(SourceFile:31)
21 com.bumptech.glide.load.engine.DataCacheWriter.boolean write(java.io.File)(SourceFile:30)
22 com.bumptech.glide.load.engine.cache.DiskLruCacheWrapper.void put(com.bumptech.glide.load.Key,com.bumptech.glide.load.engine.cache.DiskCache$Writer)(SourceFile:134)
23 com.bumptech.glide.load.engine.DecodeJob$DeferredEncodeManager.void encode(com.bumptech.glide.load.engine.DecodeJob$DiskCacheProvider,com.bumptech.glide.load.Options)(SourceFile:652)
24 com.bumptech.glide.load.engine.DecodeJob.void notifyEncodeAndRelease(com.bumptech.glide.load.engine.Resource,com.bumptech.glide.load.DataSource)(SourceFile:440)
25 com.bumptech.glide.load.engine.DecodeJob.void decodeFromRetrievedData()(SourceFile:417)
26 com.bumptech.glide.load.engine.DecodeJob.void onDataFetcherReady(com.bumptech.glide.load.Key,java.lang.Object,com.bumptech.glide.load.data.DataFetcher,com.bumptech.glide.load.DataSource,com.bumptech.glide.load.Key)(SourceFile:380)
27 com.bumptech.glide.load.engine.SourceGenerator.void onDataReady(java.lang.Object)(SourceFile:111)
28 com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.void onDataReady(java.lang.Object)(SourceFile:132)
29 com.bumptech.glide.load.data.LocalUriFetcher.void loadData(com.bumptech.glide.Priority,com.bumptech.glide.load.data.DataFetcher$DataCallback)(SourceFile:51)
30 ##parent##1##parent##
31 ##child## void close(java.lang.Object)##child##
32 com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.void loadData(com.bumptech.glide.Priority,com.bumptech.glide.load.data.DataFetcher$DataCallback)(SourceFile:96)
33 com.bumptech.glide.load.engine.SourceGenerator.boolean startNext()(SourceFile:61)
34 com.bumptech.glide.load.engine.DecodeJob.void runGenerators()(SourceFile:303)
35 com.bumptech.glide.load.engine.DecodeJob.void runWrapped()(SourceFile:273)
36 com.bumptech.glide.load.engine.DecodeJob.void run()(SourceFile:234)
37 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
38 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
39 java.lang.Thread.run(Thread.java:856)
40 com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.void run()(SourceFile:445)
Are you able to attach a sample app that reproduces the issue, a failing test case, or an example image that fails to compress?
We got log via network, The bug only reproduce some 4.2.2 and 4.2.1 Other os is fine.
We can not found machine of appear issue because we got the log via network.
App run in TV, All glide call via function showImage(). You can find it above comments
Is this a specific set of TV devices only? Or all devices run on 4.2.2 and 4.2.1? If it's specific to a device or a couple of devices can you provide the models and manufacturers?
Hi sjudd
Thank for your comments. Only some special TV(OS 4.2.2 , 4.2.1) appear the issue. Other TV(OS 4.2.2 , 4.2.1) is fine I get special devices information via network log , information below:
Toshiba TV
TCL TV
Toshiba TS42
Skyworth TV 9R15 E710U
Toshiba TV E42LX9101
Hisense TV led50xt900x3du
OS:Android 4.2.2,level 17 ROM:Hisense/led50xt900x3du CPU:armeabi-v7a
Do you have any idea whether there are any distinguishing features about the images? Are they maybe ARGB_8888 bitmaps with transparent pixels? It looks like the PNG encoder is the one crashing? Do you have any of these devices around that you might be able to test on?
We could do something as drastic as disabling the encoder on those devices with that API level if we think some substantial percentage of images are affected. You could also do the same in your app outside of Glide.
A less drastic equivalent would be disabling PNG encoding on those devices/API levels which would cause transparent pixels to show up as black if caching is enabled. That's not the end of the world if PNG encoding in general is broken or if your application doesn't typically display transparent images.
I check my code. I found use ARGB_8888 png with transparent pixels. but I has not devices.
How to disable the encoder ?
We need caching enable and display transparent images, So can you give me some advise?
You can use a custom DiskCacheStrategy
that's similar to DiskCacheStrategy.DATA
but that only writes remote data to cache. If you only load remote data in your application you can use DiskCacheStrategy.DATA
directly.
That will let you cache the unmodified image, but not the output from any transformations.
Beyond that our only choice would be to modify Glide to write transparent images to cache without transparency, which will just make the transparent pixels black when you load them again (not a great idea if you're intentionally loading transparent images). It's hard for us to work around a framework bug like this unfortunately.
This issue has been automatically marked as stale because it has not had activity in the last seven days. It will be closed if no further activity occurs within the next seven days. Thank you for your contributions.
Hi all
glide version 4.4 Android OS : 4.2.1, 4.2.2
I got below error log:
1 #00 pc 000b1c54 /system/lib/libskia.so [armeabi-v7a]
2 #01 pc 000b39e8 /system/lib/libskia.so (SkPNGImageEncoder::doEncode(SkWStream, SkBitmap const&, bool const&, int, int, SkBitmap::Config, png_color_8_struct&)+456) [armeabi-v7a] 3 #02 pc 000b3da4 /system/lib/libskia.so (SkPNGImageEncoder::onEncode(SkWStream, SkBitmap const&, int)+328) [armeabi-v7a] 4 #03 pc 000b5228 /system/lib/libskia.so (SkImageEncoder::encodeStream(SkWStream, SkBitmap const&, int)+32) [armeabi-v7a] 5 #04 pc 0006a659 /system/lib/libandroid_runtime.so [armeabi-v7a] 6 #05 pc 0001e290 /system/lib/libdvm.so (dvmPlatformInvoke+112) [armeabi-v7a] 7 #06 pc 0004d359 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const, JValue, Method const, Thread)+396) [armeabi-v7a] 8 #07 pc 00038bdd /system/lib/libdvm.so (dvmCheckCallJNIMethod(unsigned int const, JValue, Method const, Thread)+8) [armeabi-v7a] 9 #08 pc 000276a0 /system/lib/libdvm.so [armeabi-v7a] 10 #09 pc 0002b57c /system/lib/libdvm.so (dvmInterpret(Thread, Method const, JValue)+184) [armeabi-v7a] 11 #10 pc 0005fb79 /system/lib/libdvm.so (dvmCallMethodV(Thread, Method const, Object, bool, JValue, std::__va_list)+272) [armeabi-v7a] 12 #11 pc 0005fba3 /system/lib/libdvm.so (dvmCallMethod(Thread, Method const, Object, JValue, ...)+20) [armeabi-v7a] 13 #12 pc 0005471f /system/lib/libdvm.so [armeabi-v7a] 14 #13 pc 0000e3d8 /system/lib/libc.so (__thread_entry+72) [armeabi-v7a] 15 #14 pc 0000dac4 /system/lib/libc.so (pthread_create+160) [armeabi-v7a] 16 java: 17 android.graphics.Bitmap.nativeCompress(Native Method) 18 android.graphics.Bitmap.compress(Bitmap.java:875) 19 com.bumptech.glide.load.resource.bitmap.BitmapEncoder.boolean encode(com.bumptech.glide.load.engine.Resource,java.io.File,com.bumptech.glide.load.Options)(SourceFile:66) 20 com.bumptech.glide.load.resource.bitmap.BitmapEncoder.boolean encode(java.lang.Object,java.io.File,com.bumptech.glide.load.Options)(SourceFile:31) 21 com.bumptech.glide.load.engine.DataCacheWriter.boolean write(java.io.File)(SourceFile:30) 22 com.bumptech.glide.load.engine.cache.DiskLruCacheWrapper.void put(com.bumptech.glide.load.Key,com.bumptech.glide.load.engine.cache.DiskCache$Writer)(SourceFile:134) 23 com.bumptech.glide.load.engine.DecodeJob$DeferredEncodeManager.void encode(com.bumptech.glide.load.engine.DecodeJob$DiskCacheProvider,com.bumptech.glide.load.Options)(SourceFile:652) 24 com.bumptech.glide.load.engine.DecodeJob.void notifyEncodeAndRelease(com.bumptech.glide.load.engine.Resource,com.bumptech.glide.load.DataSource)(SourceFile:440) 25 com.bumptech.glide.load.engine.DecodeJob.void decodeFromRetrievedData()(SourceFile:417) 26 com.bumptech.glide.load.engine.DecodeJob.void onDataFetcherReady(com.bumptech.glide.load.Key,java.lang.Object,com.bumptech.glide.load.data.DataFetcher,com.bumptech.glide.load.DataSource,com.bumptech.glide.load.Key)(SourceFile:380) 27 com.bumptech.glide.load.engine.SourceGenerator.void onDataReady(java.lang.Object)(SourceFile:111) 28 com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.void onDataReady(java.lang.Object)(SourceFile:132) 29 com.bumptech.glide.load.data.LocalUriFetcher.void loadData(com.bumptech.glide.Priority,com.bumptech.glide.load.data.DataFetcher$DataCallback)(SourceFile:51) 30 ##parent##1##parent## 31 ##child## void close(java.lang.Object)##child## 32 com.bumptech.glide.load.model.MultiModelLoader$MultiFetcher.void loadData(com.bumptech.glide.Priority,com.bumptech.glide.load.data.DataFetcher$DataCallback)(SourceFile:96) 33 com.bumptech.glide.load.engine.SourceGenerator.boolean startNext()(SourceFile:61) 34 com.bumptech.glide.load.engine.DecodeJob.void runGenerators()(SourceFile:303) 35 com.bumptech.glide.load.engine.DecodeJob.void runWrapped()(SourceFile:273) 36 com.bumptech.glide.load.engine.DecodeJob.void run()(SourceFile:234) 37 java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 38 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 39 java.lang.Thread.run(Thread.java:856) 40 com.bumptech.glide.load.engine.executor.GlideExecutor$DefaultThreadFactory$1.void run()(SourceFile:445)