BackgroundIdentity: do not poison the auth state when a token wait is interrupted - #687
Open
Myllyenko wants to merge 1 commit into
Open
BackgroundIdentity: do not poison the auth state when a token wait is interrupted#687Myllyenko wants to merge 1 commit into
Myllyenko wants to merge 1 commit into
Conversation
BackgroundIdentity.unwrap returned null after an InterruptedException. SyncLogin.validate feeds that value straight into updateState, which CAS-ed the shared state reference to null and then threw a NullPointerException from next.init(). The reference stayed null, so every following getToken() call - on any thread - failed with a NullPointerException and authentication for the whole transport was permanently dead after a single interrupt. Throw instead of returning null, keeping the interrupt flag set. The state stays in SyncLogin, so the next getToken() re-checks the same login future and recovers on its own. updateState now also rejects a null state explicitly, so a future regression fails loudly at the call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #687 +/- ##
============================================
+ Coverage 71.91% 71.94% +0.03%
Complexity 3474 3474
============================================
Files 390 390
Lines 16220 16221 +1
Branches 1698 1699 +1
============================================
+ Hits 11664 11670 +6
+ Misses 3904 3900 -4
+ Partials 652 651 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
BackgroundIdentity.unwrapreturnednullafter anInterruptedException.SyncLogin.validatefeeds that value straight intoupdateState, which CAS-ed the shared state reference tonulland then threw aNullPointerExceptionfromnext.init(). The reference stayednull, so every followinggetToken()call - on any thread - failed with aNullPointerExceptionand authentication for the whole transport was permanently dead after a single interrupt.Throw instead of returning
null, keeping theinterruptflag set. The state stays inSyncLogin, so the nextgetToken()re-checks the same login future and recovers on its own.updateStatenow also rejects anullstate explicitly, so a future regression fails loudly at the call site.