SDWebImage 3.7.3 download and cache wrong image

Created on 22 Oct 2015  Â·  11Comments  Â·  Source: SDWebImage/SDWebImage

We found a lot of customer feedback there is some picture show another picture which means picture show not correct.

we checked our code again and agin but can't found which cause this problem, all picture request by sd_setImageWithURL

we are not bother by this question when we use SDWebImage 3.7.1

so We guess ,there must be some bug, when picture request and cache to disk.

Thank you very much

awaiting response bug

All 11 comments

Dear bpoplauschi :
i wonder is this a bug on version 3.7.3 cause load wrong image? And it will be fixed next release (version 4.0.0)?

It might be a bug, but the description you provided is not very detailed. Can you reproduce this on our demo project? There might be an issue with the way you are reusing the cells with the images.

It will be very hard to reproduce on the demo. Our apps have almost 4 million users to use. There almost a billion pictures on our server. We got this problem by users' feedback when they saw the wrong pictures.

When we debug when found the A picture store to disk be come to B picture. we check our code, and even remove the code objc_setAssociatedObject but the wrong picture is still happen.

I check out the SDWebImage and i found 3.7.2 -> 3.7.3 have some disk cache changes on code, so we guess may be the SDWebImage bug which make the wrong image.

And it is there be possible two different pictures cache to disk but use same filename?(because we have thousands of pictures)

Thanks for your answer :)

We use version 3.7.2 and we've experience the same thing. Happens very rarely so it's hard to reproduce.
Maybe related: https://github.com/rs/SDWebImage/issues/1123

We are using version 3.7.4, and yes it's very hard to reproduce

We are on 3.7.4 and get the exact same issue. I've tried using the downloader, the prefetcher and the manager in different ways and on a rare occasion this will still happen. Makes sense since they all use the same downloader.

I've narrowed it down to what I think is a race condition when storing in the cache. The cache keys are correct, but the image that gets stored in them is not. This leaves a scenario where 2 totally different cache keys point to the same image, and get stored like that, so resetting the image on the view doesn't correct the issue. The only way i've been able to get around this is clearing the cache.

I'm considering comparing the images' MD5 hashes and sending those with my server payloads to make sure that the image is the correct one, but obviously this is a very suboptimal solution.

Any insight is much appreciated!

I have the same problem on version 3.7.4 。 when can fix this issue?

Is there a solution to this in sight? We had some real trouble with a customer due to a very unlucky wrong picture which let the customer think the app "had been hacked".

Honestly we ended up moving entirely to PinRemoteImage by Pinterest. I was never able to fix this issue and it was wrecking our home page.

I believe it’s some race condition when multiple images are being downloaded simultaneously.

On Aug 17, 2016, at 12:03 AM, Sascha Wolf [email protected] wrote:

Is there a solution to this in sight? We had some real trouble with a customer due to a very unlucky wrong picture which let the customer think the app "had been hacked".

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/rs/SDWebImage/issues/1344#issuecomment-240330104, or mute the thread https://github.com/notifications/unsubscribe-auth/ACaet18mKE0nuuAmIZ6G4oAuFKFaCjIKks5qgrI_gaJpZM4GTsqe.

@rrallo even though you moved to a different project, still want to thank you for the scenario, it does make sense there's a race condition for multiple downloads. I will look into it.

can anyone have a go using the latest version?

Was this page helpful?
0 / 5 - 0 ratings