-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Kingfisher 5.7.0 crashes #1233
Comments
I got the same crash too.
|
It seems that there are simultaneous insert and remove in Set. --- /tmp/a 2019-07-31 16:01:00.000000000 +0300
+++ /tmp/b 2019-07-31 16:41:44.000000000 +0300
@@ -46,7 +46,7 @@
var keys = Set<String>()
var cleanTimer: Timer? = nil
- let lock = NSLock()
+ let lock = NSRecursiveLock()
let cacheDelegate = CacheDelegate<StorageObject<T>>()
@@ -69,6 +69,8 @@
storage.countLimit = config.countLimit
storage.delegate = cacheDelegate
cacheDelegate.onObjectRemoved.delegate(on: self) { (self, obj) in
+ self.lock.lock()
+ defer { self.lock.unlock() }
self.keys.remove(obj.key)
}
|
@zdo Yes. You are right! But I do not quite want to introduce a recursive lock into the project. It is a bit lazy and hides some fact of locking resource. I would check whether we can keep using normal lock for this purpose. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Issue Description
I haven't seen this crash before, so I will assume that this is caused by the latest version of Kingfisher.
What
I been receiving these reports from Crashlytics
Crash log
The text was updated successfully, but these errors were encountered: