-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Dead lock #507
Comments
Some additional info, i tried to fix this issue by:
Now i saw that this change was introduced recently and probably for a good reason, but doing dispatch_sync on the main thread IMHO doesn't seem as a good idea, as it might be other wise busy, why not use dispatch_async here? |
One last note: checking this commit 3a6d948 i see that you turned a lot of async calls to sync calls, just saying. |
FYI, I'm experiencing the exact same issue at the moment :-) |
Got the same issue. |
Related to #509 |
I can reliably reproduce this problem using SDWebImage 3.7.2, Xcode 6.2, in the iPhone 6 iOS 8.2 simulator. See this project: |
@nicksnyder you produce the deadlock by setting the maxConcurrentDownloads to 1024. This sets the |
I didn't mean to imply that 1024 was the smallest number needed to deadlock, but it does seem to vary based on the hardware being run on (which is why I put a silly high number in the bug report). 32 concurrent operations performs better than 3 (the default) in my project. I was manually searching for the sweet spot which is when I reproduced the deadlock. The deadlock is indeed still a bug with SDWebImage, right? |
i think that the deadlock in SDWebImage occurs because of race conditions happening while requests are cancelled or finished. NSOperationQueue does not dequeue an operation until its finished state changes to true. So there might be some issues there. |
Dead lock when using - (BOOL)diskImageExistsForURL:(NSURL *)url; to check if image exists on the disc.
As it's calling:
(BOOL)diskImageExistsWithKey:(NSString *)key
{
__block BOOL exists = NO;
//
// DEAD LOCK HERE
//
dispatch_sync(_ioQueue, ^
{
exists = [_fileManager fileExistsAtPath:[self defaultCachePathForKey:key]];
});
return exists;
}
and another thread is waiting on:
in this method: - (NSOperation *)queryDiskCacheForKey:(NSString *)key done:(void (^)(UIImage *image, SDImageCacheType cacheType))doneBlock;
The text was updated successfully, but these errors were encountered: