Skip to content

BackgroundIdentity: do not poison the auth state when a token wait is interrupted - #687

Open
Myllyenko wants to merge 1 commit into
ydb-platform:masterfrom
Myllyenko:fix/background-identity-interrupt
Open

BackgroundIdentity: do not poison the auth state when a token wait is interrupted#687
Myllyenko wants to merge 1 commit into
ydb-platform:masterfrom
Myllyenko:fix/background-identity-interrupt

Conversation

@Myllyenko

@Myllyenko Myllyenko commented Aug 5, 2026

Copy link
Copy Markdown

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.

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>
@Myllyenko Myllyenko changed the title BackgroundIdentity: Do not poison the auth state when a token wait is interrupted BackgroundIdentity: do not poison the auth state when a token wait is interrupted Aug 5, 2026
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 71.94%. Comparing base (d876581) to head (4d663e3).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant