[Config] Mark two RCNConfigSettings properties atomic
#13925
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The crashing frame is on
objc_release_x0so I'm thinking that that the instance is being over-released.These properties are never sent in
RCNConfigSettings's initialization but rather on one of two different queues:firebase-ios-sdk/FirebaseRemoteConfig/Sources/RCNConfigFetch.m
Lines 302 to 311 in 8328630
firebase-ios-sdk/FirebaseRemoteConfig/Sources/RCNConfigRealtime.m
Lines 263 to 272 in 8328630
They are currently marked
nonatomic, so my hypothesis is that concurrent sets lead to an object with an invalid retain count, and when the property is later accessed here. It causes a crash when trying to over-release the invalid instance.I did some searching and
atomicseemed to be an acceptable solution. Others were to add a queue insideRCNConfigSettingswhich seemed too heavyweight, as well as overwriting the getter and setter to use@synchronizedwhich seemed reasonable but adding atomic was less LOC.Fix #13898