Repository navigation
fix: make JDK 28-ea CI pass (CloudTasks test race, old Mockito in e2etests) #568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
03dda2c
fix(taskqueue): prevent real CloudTasksClient from replacing test stubs
maigovannon ca5714c
fix(e2etests): drop mockito-all 2.0.2-beta so tests run on JDK 28
maigovannon 82fe322
fix(taskqueue): close displaced clients and read shared clients once
maigovannon c686537
fix(taskqueue): cancel in-flight calls on displaced clients; harden t…
maigovannon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two edge cases worth tightening while we are touching these setters:
First, if the race described in the comment triggers, getClient() will have already assigned a real CloudTasksClient (backed by a live Netty channel and executor threads) to sharedClient right before setSharedClientForTesting acquires CLIENT_INIT_LOCK. Overwriting that reference without closing the displaced instance leaks its channel and background threads for the lifetime of the JVM; closing it outside the lock also ensures any stray caller fails fast locally rather than reaching cloudtasks.googleapis.com. (Worth marking both parameters @nullable as well to match setEnabledForTesting above.)
Second, getClient() (lines 644/688) and getV2Beta3Client() (lines 693/738) read the volatile field twice without a local variable (if (sharedClient == null) { ... } return sharedClient;). If tearDown() calls setSharedClientForTesting(null) between those two reads, getClient() can return null and NPE at the call site. Reading into a local client variable fixes the double-checked locking read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed