Repository navigation
Replace @synchronized(self) in GIDGoogleUser with a private lock - #652
Merged
Merged
Conversation
There was a problem hiding this comment.
Code Review
This pull request replaces @synchronized(self) with a recursive lock (_authStateLock) in GIDGoogleUser to serialize auth state updates and reads, avoiding potential deadlocks during KVO notifications. Feedback on the changes identifies a potential crash in refreshTokensIfNeededWithCompletion: if lastTokenAdditionalParameters is nil, as passing nil to addEntriesFromDictionary: raises an exception. A guard or fallback dictionary is recommended to prevent this crash.
This was referenced Oct 15, 2026
w-goog
force-pushed
the
fix/googleuser-auth-state-lock
branch
from
October 15, 2026 22:39
61e2916 to
a6d3717
Compare
w-goog
added this pull request to stack #654
October 15, 2026 22:48
w-goog
commented
Oct 15, 2026
w-goog
force-pushed
the
fix/googleuser-auth-state-lock
branch
from
October 15, 2026 23:11
a6d3717 to
988f058
Compare
brnnmrls
reviewed
Oct 17, 2026
brnnmrls
reviewed
Oct 17, 2026
brnnmrls
reviewed
Oct 17, 2026
w-goog
force-pushed
the
fix/googleuser-auth-state-lock
branch
from
October 19, 2026 20:04
988f058 to
0e17431
Compare
brnnmrls
reviewed
Oct 19, 2026
brnnmrls
reviewed
Oct 19, 2026
brnnmrls
approved these changes
Oct 19, 2026
Base automatically changed from
fix/googleuser-snapshot-scopes-config-profile
to
main
October 20, 2026 16:06
w-goog
force-pushed
the
fix/googleuser-auth-state-lock
branch
from
October 20, 2026 16:06
0cfb17d to
75884b5
Compare
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.
@synchronized(self)to synchronize on a private lock, to prevent other callers from battling for the user object's lock. The private lock remains recursive, because AppAuth callsdidChangeState/ KVO observers may need to re-enter.emmSupportandencodeWithCoderto use said lock.authStatewithout the lock. Tracked inGIDGoogleUser.authStateis sometimes read without a lock #648.