picasso: Getting 504 Gateway Timeout from ResponseException
I’m having an issue on some devices on the same network when downloading photos from Flickr. Following your suggestion on a previous issue, here is how I’m calling Picasso:
OkHttpClient client = new OkHttpClient();
client.setProtocols(Arrays.asList(Protocol.HTTP_11));
Picasso picasso = new Picasso.Builder(c)
.downloader(new OkHttpDownloader(client))
.listener(new Listener() {
@Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception) {
exception.printStackTrace();
}
})
.build();
And here is the full stack trace of the exception I’m getting:
com.squareup.picasso.Downloader$ResponseException: 504 Gateway Timeout
at com.squareup.picasso.OkHttpDownloader.load(OkHttpDownloader.java:108)
at com.squareup.picasso.NetworkBitmapHunter.decode(NetworkBitmapHunter.java:46)
at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:123)
at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:83)
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.squareup.picasso.Utils$PicassoThread.run(Utils.java:306)
I tried playing with client.setConnectTimeout
and client.setReadTimeout
but they don’t seem to influence the downloader at all. The crash always occur before any timeout I set. Any ideas?
Thanks.
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 28
https://stackoverflow.com/a/50834600