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

Crash on tracker.configuration.parameters #136

Open
peseriusz opened this issue Jun 6, 2022 · 0 comments
Open

Crash on tracker.configuration.parameters #136

peseriusz opened this issue Jun 6, 2022 · 0 comments

Comments

@peseriusz
Copy link

peseriusz commented Jun 6, 2022

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)
image

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:

  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.

@peseriusz peseriusz changed the title v Crash on tracker.configuration.parameters Jun 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant