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
In most cases MixPanelInstance references superProperties from a block executed from the trackingQueue and under readWriteLock and so the reference is thread safe. As in registerSuperProperties:
Repeated calls to
currentSuperProperties
andunregisterSuperProperty
can cause a crash.We are seeing this occur frequently in our production app.
Diagnosis
In most cases MixPanelInstance references
superProperties
from a block executed from thetrackingQueue
and underreadWriteLock
and so the reference is thread safe. As inregisterSuperProperties
:However,
currentSuperProperties
only protectssuperProperties
withreadWriteLock
:and
unregisterSuperProperty
only protectssuperProperties
withtrackingQueue
:this causes a crash when both
unregisterSuperProperty
andcurrentSuperProperties
are called from different threads at the same time.The following unit test simulates the problem:
Solution
The solution should be straightforward. Reference
superProperties
underreadWriteLock
inunregisterSuperProperty
and similarly inupdateSuperProperty
The text was updated successfully, but these errors were encountered: