Open peseriusz opened 2 years ago
I found issue with access to
tracker.configuration.parameters
in (main thread):
class func sendOfflineHits(_ tracker: Tracker, forceSendOfflineHits: Bool, async: Bool = true)
in first line:
if((tracker.configuration.parameters["storage"] != "always" || forceSendOfflineHits)
It looks like there is parallel access to
second call comes from Tracker.swift
@objc public func setConfig(_ configuration: [String: String], override: Bool = false, sync: Bool = false, completionHandler: ((_ isSet: Bool) -> Void)?) {
saving value:
self.configuration.parameters[key] = value
from this code:
let configurationOperation = BlockOperation(block: { self.configuration.parameters[key] = value if let identifier = self.configuration.parameters["identifier"], identifier != "" { self.buffer.recomputeUserId() } }) (...) TrackerQueue.sharedInstance.queue.addOperation(configurationOperation)
(background thread).
Access to dictionary is not threads safe in Swift.
I found issue with access to
tracker.configuration.parameters
in (main thread):
class func sendOfflineHits(_ tracker: Tracker, forceSendOfflineHits: Bool, async: Bool = true)
in first line:
if((tracker.configuration.parameters["storage"] != "always" || forceSendOfflineHits)
It looks like there is parallel access to
tracker.configuration.parameters
second call comes from Tracker.swift
@objc public func setConfig(_ configuration: [String: String], override: Bool = false, sync: Bool = false, completionHandler: ((_ isSet: Bool) -> Void)?) {
saving value:
self.configuration.parameters[key] = value
from this code:
(background thread).
Access to dictionary is not threads safe in Swift.