Kingfisher: URLRequest timeout after certain amount of successful loads

Created on 11 Oct 2019  ·  4Comments  ·  Source: onevcat/Kingfisher

This is just a reminder that the issue described in #809 still persists and since it was closed I thought I ping it and give some extra information.

The problem about the URLRequest timeout

Task <937CEFC3-1CFF-41BA-BD64-B00160F3EFC6>.<460> finished with error - code: -1001

happens in my macOS program where I have a basic tableview which shows a thumbnail for every entry which I load via Kingfisher from a server. After a certain amount of fine (and fast) loads the displaying of new images just stops and after the timeout expires (no matter how long I set it) the above error code is logged for each new image (no Kingfisher completion handler error btw). It at that point can only show the already loaded and cached entries.

The error code indicates a timeout on the request, but if I load the URL manually in a browser it loads fine in a few milliseconds and when I restart the app and start loading from where it stopped last time all images load fine until the next error arises. So I don't think it is a server issue.

The debugging is hard for me because as soon as I get to the point where the URLRequest is made in Kingfisher the timeout is in effect and after that time the debugger crashes on me.

Oddly enough, the "fix" commented in #809 with setting the activity indicator on the imageview only seems to push this threshold after which loading fails again a little bit further back (without after ca. 100 images; and with after ca. 250 images).

Note: The images are fairly large (around 4k) since thumbnails do not exist but I don't think that that is the key issue, maybe just causes the error to appear sooner.

Most helpful comment

I guess this might relate to a case that you started a lot of downloads tasks and the network gets fully used and blocked by earlier requests. The downloading task from a later request lasts too long to finish.

A thing is worth to try: Following the performance tip here, to cancel any download tasks that not necessary and won't be displayed. This can reduce the networking pressure and help to download images which will be displayed soon.

Or you can try to set a large number for download timeout:

KingfisherManager.shared.downloader.downloadTimeout = 600
// Set time out to 10 minutes. The default is 15 seconds.

All 4 comments

@OhKai Hi do you guys have any updates on this issue?
I am currently experiencing this issue
Is there any work-around for this one?
Thanks

@rhkrthdud7 Unfortunately, I was not able to fix this using Kingfisher and instead switched to SDWebImage (which I understand Kingfisher is a Swift port of) and don't have this problem now.

Having the same issue here. Did anyone find a proper solution for this one?

I guess this might relate to a case that you started a lot of downloads tasks and the network gets fully used and blocked by earlier requests. The downloading task from a later request lasts too long to finish.

A thing is worth to try: Following the performance tip here, to cancel any download tasks that not necessary and won't be displayed. This can reduce the networking pressure and help to download images which will be displayed soon.

Or you can try to set a large number for download timeout:

KingfisherManager.shared.downloader.downloadTimeout = 600
// Set time out to 10 minutes. The default is 15 seconds.
Was this page helpful?
0 / 5 - 0 ratings