bumptech / bumptech/glide

RequestListener receives an “empty” GlideException when the request is incomplete due to timeout

Open
#4,126 5 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
35k
Forks
6.2k
Avg merge
1d 11h
Merged PRs (30d)
8

Description

When the server sends some data, and then simply stops, or when it closes the connection halfway, `RequestListener` will receive a `GlideException` with an empty `getRootCauses()` return value. This is likely happening because `StreamEncoder#encode()` [logs the exception without propagating it](https://github.com/bumptech/glide/blob/master/library/src/main/java/com/bumptech/glide/load/model/StreamEncoder.java#L39-L41).

You can reproduce the issue by starting a timeouting web server:

% { echo -ne "HTTP/1.0 200 OK\r\nContent-Length: 123\r\n\r\n"; echo "foo" } | nc -l 8080

and then trying to load it with:

Glide.with(this).load("http://192.168.1.107:8080").listener(new RequestListener() {
@Override public boolean onLoadFailed(@Nullable GlideException e, Object model, Target target, boolean isFirstResource) {
Log.i("Glide", "root causes: " + e.getRootCauses());
return false;
}

@Override public boolean onResourceReady(Drawable resource, Object model, Target target, DataSource dataSource, boolean isFirstResource) {
return false;
}
}).into(imageView);

this will yield:

W/Glide: Load failed for http://192.168.1.107:8080 with size [2112x2112]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
I/Glide: root causes: []

**Glide Version**: 4.11.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.