Skip to content

Fix deadlock in AccMgrAuthTokenProvider when account is removed during token refresh#2846

Merged
wmathurin merged 1 commit intoforcedotcom:devfrom
wmathurin:dev
Feb 27, 2026
Merged

Fix deadlock in AccMgrAuthTokenProvider when account is removed during token refresh#2846
wmathurin merged 1 commit intoforcedotcom:devfrom
wmathurin:dev

Conversation

@wmathurin
Copy link
Contributor

When logout occurs while threads are refreshing tokens, the method will return for matchingAccount == null and therefore the lock.notifyAll() that is later in the method will never be called causing other threads to be stuck on lock.wait(). Now the try-finally wraps all the logic after gettingAuthToken = true to ensure that lock.notifyAll() is always called.

Fixes W-21304558

…g token refresh

When logout occurs while threads are refreshing tokens, the method will return for matchingAccount == null and therefore the lock.notifyAll() that is later in the method will never be called causing other threads to be stuck on lock.wait().
Now the try-finally wraps all the logic after gettingAuthToken = true to ensure that lock.notifyAll() is always called.

Fixes W-21304558
@codecov
Copy link

codecov bot commented Feb 27, 2026

Codecov Report

❌ Patch coverage is 88.23529% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.57%. Comparing base (9e8338d) to head (221431a).
⚠️ Report is 3 commits behind head on dev.

Files with missing lines Patch % Lines
.../com/salesforce/androidsdk/rest/ClientManager.java 88.23% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                dev    #2846      +/-   ##
============================================
+ Coverage     64.55%   64.57%   +0.02%     
- Complexity     2925     2926       +1     
============================================
  Files           222      222              
  Lines         17323    17338      +15     
  Branches       2471     2474       +3     
============================================
+ Hits          11182    11196      +14     
  Misses         4934     4934              
- Partials       1207     1208       +1     
Components Coverage Δ
Analytics 47.92% <ø> (ø)
SalesforceSDK 59.08% <84.37%> (+0.05%) ⬆️
Hybrid 59.05% <ø> (ø)
SmartStore 78.20% <ø> (ø)
MobileSync 81.68% <ø> (ø)
React 52.36% <ø> (ø)
Files with missing lines Coverage Δ
.../com/salesforce/androidsdk/rest/ClientManager.java 62.79% <88.23%> (+0.66%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wmathurin wmathurin merged commit 115372e into forcedotcom:dev Feb 27, 2026
22 of 23 checks passed
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.

2 participants