Fix deadlock when sending notification center in customerInfoListener#2407
Merged
Conversation
Member
Author
aboedo
commented
Apr 14, 2023
|
|
||
| Logger.verbose(Strings.purchase.device_cache_init(self)) | ||
|
|
||
| // Observe `UserDefaults` changes through `handleUserDefaultsChanged` |
Member
Author
There was a problem hiding this comment.
this just used to detect if someone deletes RevenueCat data under the hood. It's saved us quite a few times, but still, now that we don't default to .standard, I don't think it adds that much value. And it's causing race conditions which have proven tricky to fix.
NachoSoto
approved these changes
Apr 14, 2023
| // Note: this should never use `self.userDefaults` directly because this method | ||
| // might be synchronized, and `Atomic` is not reentrant. | ||
| if self.cachedAppUserID != nil && Self.cachedAppUserID(userDefaults) == nil { | ||
| fatalError(Strings.purchase.cached_app_user_id_deleted.description) |
Contributor
There was a problem hiding this comment.
I think this string can be deleted now.
aboedo
added a commit
that referenced
this pull request
Apr 14, 2023
…#2407) Fixes an issue where a deadlock could happen if you fire a notification in the customerInfoListener. The issue stems from our usage of NotificationCenter to detect deletion of userDefaults. Since we've changed the default UserDefaults anyway, I don't feel like this adds much value anymore, and we've spent wayyyy too much time dealing with race conditions caused by it, so I'm just getting rid of it. I couldn't get it to reproduce on my device, but @codykerns was able to get a consistent repro and confirmed the fix with this branch.
Closed
NachoSoto
pushed a commit
that referenced
this pull request
Apr 14, 2023
…#2407) Fixes an issue where a deadlock could happen if you fire a notification in the customerInfoListener. The issue stems from our usage of NotificationCenter to detect deletion of userDefaults. Since we've changed the default UserDefaults anyway, I don't feel like this adds much value anymore, and we've spent wayyyy too much time dealing with race conditions caused by it, so I'm just getting rid of it. I couldn't get it to reproduce on my device, but @codykerns was able to get a consistent repro and confirmed the fix with this branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.


Fixes an issue where a deadlock could happen if you fire a notification in the customerInfoListener.
The issue stems from our usage of NotificationCenter to detect deletion of userDefaults.
Since we've changed the default UserDefaults anyway, I don't feel like this adds much value anymore, and we've spent wayyyy too much time dealing with race conditions caused by it, so I'm just getting rid of it.
I couldn't get it to reproduce on my device, but @codykerns was able to get a consistent repro and confirmed the fix with this branch.