fix(auth): Address ClientSideCredentialAccessBoundary RefreshTask race condition#12681
Merged
lqiu96 merged 4 commits intogoogleapis:mainfrom Apr 13, 2026
Merged
fix(auth): Address ClientSideCredentialAccessBoundary RefreshTask race condition#12681lqiu96 merged 4 commits intogoogleapis:mainfrom
lqiu96 merged 4 commits intogoogleapis:mainfrom
Conversation
This change addresses a race condition in ClientSideCredentialAccessBoundaryFactory that occurred when multiple concurrent calls were made to generateToken. The fix involves: - Waiting on the RefreshTask itself rather than its internal task. - Using a single listener in RefreshTask to ensure finishRefreshTask completes before the outer future unblocks waiting threads. - Adding a regression test generateToken_freshInstance_concurrent_noNpe.
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the RefreshTask in ClientSideCredentialAccessBoundaryFactory to use a single listener, ensuring internal state updates occur before the future completes. It also simplifies the refresh logic and adds a concurrent test case to address a race condition. Feedback was provided to enhance the robustness of error handling in the task listener, specifically by catching Throwable and handling null causes in ExecutionException to avoid potential hangs.
...java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactory.java
Show resolved
Hide resolved
lqiu96
reviewed
Apr 10, 2026
...java/com/google/auth/credentialaccessboundary/ClientSideCredentialAccessBoundaryFactory.java
Show resolved
Hide resolved
lqiu96
approved these changes
Apr 10, 2026
Member
|
Thanks for the fix @vverman ! Changes LGTM |
This was referenced Apr 13, 2026
diegomarquezp
added a commit
that referenced
this pull request
Apr 14, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>1.85.0</summary> ## [1.85.0](v1.84.0...v1.85.0) (2026-04-14) ### Features * [appoptimize] new module for appoptimize ([#12768](#12768)) ([050187d](050187d)) * [chronicle] Add DataTableService to Chronicle v1 Client Libraries ([fc62b1e](fc62b1e)) * [databasecenter] Add support for BigQuery datasets and ([fc62b1e](fc62b1e)) * [dataplex] Allow Data Documentation DataScans to support BigQuery ([fc62b1e](fc62b1e)) * [dataproc] Add `Engine` field to support LightningEngine in ([fc62b1e](fc62b1e)) * [discoveryengine] add AUTO condition to SearchAsYouTypeSpec in ([fc62b1e](fc62b1e)) * [infra-manager] adding DeploymentGroups, you can now manage ([fc62b1e](fc62b1e)) * [kms] add a variable to SingleTenantHsmInstanceCreate to control ([fc62b1e](fc62b1e)) * [kms] support external-μ in the Digest ([fc62b1e](fc62b1e)) * [shopping-merchant-products] a new field `base64_encoded_name` is ([fc62b1e](fc62b1e)) * [vectorsearch] Added CMEK support ([fc62b1e](fc62b1e)) ### Bug Fixes * **auth:** Address ClientSideCredentialAccessBoundary RefreshTask race condition ([#12681](#12681)) ([30088d2](30088d2)) * **bqjdbc:** lazily instantiate Statement in BigQueryDatabaseMetaData ([#12752](#12752)) ([72e5508](72e5508)) * **deps:** update the Java code generator (gapic-generator-java) to ([fc62b1e](fc62b1e)) * **gdch:** support EC private keys ([#1896](#1896)) ([bf926fb](bf926fb)) * update appoptimize version to 0.0.1 to match released repo ([#12782](#12782)) ([80dfac6](80dfac6)) ### Documentation * [network-management] Update comment for the `region` field in ([fc62b1e](fc62b1e)) * [shopping-merchant-inventories] A comment for field `name` in ([fc62b1e](fc62b1e)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
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.
This change addresses a race condition in ClientSideCredentialAccessBoundaryFactory that occurred when multiple concurrent calls were made to generateToken.
The fix involves: