Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Handling in Glide #126

Closed
yelinaung opened this issue Sep 8, 2014 · 2 comments
Closed

Error Handling in Glide #126

yelinaung opened this issue Sep 8, 2014 · 2 comments
Labels
Milestone

Comments

@yelinaung
Copy link

It may relate to #84 but I am looking for a workaround for the SocketTimeOutException like below

System.err  
W  java.net.SocketTimeoutException
W      at java.net.PlainSocketImpl.read(PlainSocketImpl.java:491)
W      at java.net.PlainSocketImpl.access$000(PlainSocketImpl.java:46)
W      at java.net.PlainSocketImpl$PlainSocketInputStream.read(PlainSocketImpl.java:240)
W      at java.io.BufferedInputStream.read(BufferedInputStream.java:304)
W      at libcore.net.http.FixedLengthInputStream.read(FixedLengthInputStream.java:45)
W      at java.io.InputStream.read(InputStream.java:163)
W      at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:131)
W      at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:310)
W      at java.io.InputStream.read(InputStream.java:163)
W      at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.fillbuf(RecyclableBufferedInputStream.java:131)
W      at com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream.read(RecyclableBufferedInputStream.java:310)
W      at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
W      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:535)
W      at com.bumptech.glide.load.resource.bitmap.Downsampler.decodeStream(Downsampler.java:310)
W      at com.bumptech.glide.load.resource.bitmap.Downsampler.downsampleWithSize(Downsampler.java:210)
W      at com.bumptech.glide.load.resource.bitmap.Downsampler.decode(Downsampler.java:179)
W      at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:41)
W      at com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder.decode(StreamBitmapDecoder.java:18)
W      at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:38)
W      at com.bumptech.glide.load.resource.bitmap.ImageVideoBitmapDecoder.decode(ImageVideoBitmapDecoder.java:19)
W      at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:55)
W      at com.bumptech.glide.load.resource.gifbitmap.GifBitmapWrapperResourceDecoder.decode(GifBitmapWrapperResourceDecoder.java:20)
W      at com.bumptech.glide.load.engine.SourceResourceRunner.decodeFromSource(SourceResourceRunner.java:180)
W      at com.bumptech.glide.load.engine.SourceResourceRunner.runWrapped(SourceResourceRunner.java:141)
W      at com.bumptech.glide.load.engine.SourceResourceRunner.run(SourceResourceRunner.java:123)
W      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
W      at java.util.concurrent.FutureTask.run(FutureTask.java:234)
W      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
W      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
W      at java.lang.Thread.run(Thread.java:841)
W      at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:52)
skia  D  ---- read threw an exception
D  --- decoder->decode returned false

Is there anywork around for it ?

@sjudd
Copy link
Collaborator

sjudd commented Sep 8, 2014

Yes this is a duplicate of #84. To be clear nothing you do is going to solve the underlying problem. If your socket times out, particularly if it does so repeatedly, no networking library will be able to retrieve the data you need.

That being said we can definitely handle this failure case more gracefully in the default HttpUrlConnection based url fetcher. For now at least using Volley will make sure you receive the error and can handle it appropriately because Volley reads all of the data out of the InputStream before returning it to us. I'd guess OkHttp will also let us handle the failure case, but I haven't tested it.

@sjudd
Copy link
Collaborator

sjudd commented Oct 30, 2014

Internal bug tracking this is b/17419670.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants