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

SDWebImageDownloaderOperation isFinished - race condition #3275

Closed
3 tasks done
ganeshAir opened this issue Sep 28, 2021 · 10 comments · Fixed by #3479
Closed
3 tasks done

SDWebImageDownloaderOperation isFinished - race condition #3275

ganeshAir opened this issue Sep 28, 2021 · 10 comments · Fixed by #3479
Labels
stale thread safe Thread Safe related topic
Milestone

Comments

@ganeshAir
Copy link

ganeshAir commented Sep 28, 2021

New Issue Checklist

Issue Info

Info Value
Platform Name e.g. ios / macos / tvos / watchos
Platform Version e.g. 12.0 / 10.14.0 / 12.0 / 5.0
SDWebImage Version e.g. 5.0.0 / 4.4.0
Integration Method e.g. carthage / cocoapods / manually
Xcode Version e.g. Xcode 11 / Xcode 10
Repro rate e.g. all the time (100%) / sometimes x% / only once
Repro with our demo prj e.g. does it happen with our demo project?
Demo project link e.g. link to a demo project that highlights the issue

Issue Description and Steps

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.

Screenshot 2021-09-28 at 2 08 31 PM

@ganeshAir
Copy link
Author

Need to synchronize the getter and setter.

@kinarobin
Copy link
Member

@ganeshAir How about using the latest version 5.11.1 ?

@ganeshAir
Copy link
Author

Issue is happening in the latest version as well.

@ganeshAir
Copy link
Author

Screenshot 2021-09-28 at 2 08 31 PM

@kinarobin kinarobin reopened this Sep 28, 2021
@kinarobin
Copy link
Member

@ganeshAir Reproduce demo, thanks.

@ganeshAir
Copy link
Author

ganeshAir commented Sep 28, 2021 via email

@dreampiggy dreampiggy added the thread safe Thread Safe related topic label Sep 30, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

@stale stale bot added the stale label Apr 17, 2022
@stale stale bot closed this as completed Apr 27, 2022
@iDevPro
Copy link

iDevPro commented Jan 18, 2023

Hello, latest version of SD (main branch),
Снимок экрана 2023-01-18 в 17 53 00

SDWebImagePrefetcher.shared.prefetchURLs -> RaceCodition
Example.prefetchUrls on image call SDWebImagePrefetcher.shared.prefetchURLs

@dreampiggy
Copy link
Contributor

dreampiggy commented Jan 19, 2023

Seems this SDAsyncBlockOperation need a synchronized solution for that isFinished property, will fix in 5.15.1

@dreampiggy dreampiggy added this to the 5.15.1 milestone Jan 19, 2023
@dreampiggy dreampiggy reopened this Feb 6, 2023
@dreampiggy
Copy link
Contributor

dreampiggy commented Feb 6, 2023

In this example, the issue happends because SDAsyncBlockOperation is called with complete even before the actualstart method (which is the entry for NSOperation)

This may a case when ImageManager has already cache the image in memory cache, so it callback in sync but not async, cause logic error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale thread safe Thread Safe related topic
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants