You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Cancelling one asynchronous token request cancels other callers sharing its refresh #427
The asynchronous token cache returns its internal in-flight CompletableFuture directly to every caller waiting for the same refresh. Cancelling any returned future therefore cancels the shared operation from the other callers' perspective. A later caller can also receive the already-cancelled future while the provider is still working.
A deterministic reproduction is to make an AccessTokenProvider return a manually controlled future, call CachingAccessTokenProvider.getAsync twice, cancel the first returned future, and then complete the provider's future successfully. The second caller receives CancellationException rather than the provider's token.
This also affects the chained forced-refresh path: cancelling the original returned future can trigger the next provider call before the original provider has finished. Explicitly completing a caller's returned future likewise completes every other caller's shared result.
Each caller should own its returned future while the cache owns the shared refresh future. Cancelling or completing one caller's future should not settle another caller or change when a forced provider refresh starts.
Six controlled-future tests reproduce five failures on main; the advisory-refresh control passes. No sleeps, network calls or live credentials are needed. This is distinct from #426, which handles exceptions while launching a refresh.
Closing as not planned. The token cache and its futures are internal. Callers only receive futures derived with thenApply, and cancelling one doesn't reach the shared refresh. See #413 (comment) for context on how we're handling this batch of reports. If you hit this in real usage, reply with the details and we'll reopen.
Activity
tomer-ant commentedon Oct 14, 2026
Closing as not planned. The token cache and its futures are internal. Callers only receive futures derived with thenApply, and cancelling one doesn't reach the shared refresh. See #413 (comment) for context on how we're handling this batch of reports. If you hit this in real usage, reply with the details and we'll reopen.