You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Xcode 16.1 on macOs 15.1.1
Kingfisher Swift package 8.1.1
Using the KFImage struct to load multiple different images asynchronously results in a race condition inside the onDataReceived method of the ImageLoadingProgressiveSideEffect class.
The onDataReceived method checks the amount of data received with a direct access to the count property of the mutableData property of the SessionDataTask class. Running my iOS app in the simulator under iOS 18.1 with the thread sanitizer enabled reports this access as a potential race condition.
There is another race condition inside the SessionDelegate extension. The urlSession.didReceive method calls the task.didReceiveData method of the SessionDataTask class. The access to mutableData through this method is not thread safe, because a lock is missing inside the "didReceiveData" method.
Reproduce
Calling the following SwiftUI view concurrently several times will reproduce the issue:
Creating a computed property muatbleDataCount inside the SessionDataTask class with a lock for the access to the size of mutableData as well as adding a lock to the didReceiveData method fixes the problems
The text was updated successfully, but these errors were encountered:
Check List
Thanks for considering to open an issue. Before you submit your issue, please confirm these boxes are checked.
Xcode 16.1 on macOs 15.1.1
Kingfisher Swift package 8.1.1
Using the KFImage struct to load multiple different images asynchronously results in a race condition inside the onDataReceived method of the ImageLoadingProgressiveSideEffect class.
The onDataReceived method checks the amount of data received with a direct access to the count property of the mutableData property of the SessionDataTask class. Running my iOS app in the simulator under iOS 18.1 with the thread sanitizer enabled reports this access as a potential race condition.
There is another race condition inside the SessionDelegate extension. The urlSession.didReceive method calls the task.didReceiveData method of the SessionDataTask class. The access to mutableData through this method is not thread safe, because a lock is missing inside the "didReceiveData" method.
Reproduce
Calling the following SwiftUI view concurrently several times will reproduce the issue:
Other Comment
Creating a computed property muatbleDataCount inside the SessionDataTask class with a lock for the access to the size of mutableData as well as adding a lock to the didReceiveData method fixes the problems
The text was updated successfully, but these errors were encountered: