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

fix: Replace subscriptpattern by calling setValue #96

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hivinau
Copy link

@hivinau hivinau commented Oct 1, 2020

There is a crash that occurs in iOS 11 (iPhone 6S) doing :

let tracker = ATInternet.sharedInstance.tracker(Constants.trackerName, configuration: configuration)
tracker.context.level2 = Constants.iosLevel2Id

Capture d’écran 2020-09-28 à 17 38 56

Here, key contains s2 as value. By doing, po buffer.persistentParameters[key], it returns nil.
I don't really know the reason for this, but calling setValue(value :, forKeyPath :) instead of the subscript method, there are no more crashes

@nsagnett
Copy link
Contributor

nsagnett commented Oct 2, 2020

Sorry but i can't reproduce your crash...have you any other input to reproduce ?

@hivinau
Copy link
Author

hivinau commented Oct 6, 2020

Unfortunately, we cannot reproduce this with concrete data. However, I would like to point out that this crash only occurs on iOS 11 and iOS 12.

@ghugues
Copy link
Contributor

ghugues commented Dec 7, 2020

We're seeing the same crash. It happens when processSetParam(_:value:options:) is called simultaneously (or almost simultaneously) from multiple threads. This is actually not surprising since the volatileParameters is not protected agains simultaneous accesses and mutating a Swift dictionary from multiple threads is undefined behavior and most likely to crash.

The question is : Is the SDK supposed to be thread safe ? In which case this is a SDK bug. Or is it not ? In which case it is a programmer error to use it simultaneously from multiple threads.

@nsagnett
Copy link
Contributor

nsagnett commented Dec 7, 2020

Unfortunately, the SDK is not thread safe

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

Successfully merging this pull request may close these issues.

3 participants