Skip to content

Conversation

@clundin25
Copy link
Contributor

@clundin25 clundin25 commented Sep 29, 2022

Fork of #1002 with test fixes.

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> ☕️

If you write sample code, please follow the samples format.

@clundin25 clundin25 requested a review from a team as a code owner September 29, 2022 18:41
@product-auto-label product-auto-label bot added the size: s Pull request size is small. label Sep 29, 2022
@clundin25 clundin25 mentioned this pull request Sep 29, 2022
4 tasks
@product-auto-label product-auto-label bot added size: m Pull request size is medium. and removed size: s Pull request size is small. labels Sep 30, 2022
Copy link
Contributor

@johanblumenberg johanblumenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

I tried it in our product as well and it seems to work

@petedmarsh
Copy link

petedmarsh commented Oct 7, 2022

@johanblumenberg @igorbernstein2 @TimurSadykov

I've also been affected by this race condition and I would like to see a fix (this one looks along the right lines to me at least), but I think there may be one thing missing which is making the refreshTask volatile too as in:

#1046

Edit: making it volatile is not required, the synchronized block is enough.

this.listener = listener;

// Update Credential state first
task.addListener(listener, MoreExecutors.directExecutor());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you should either in-line both callbacks or move all the callback logic into the listener class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to inject a sleep to exercise the race condition I wrote it like this. Agreed the logic could be better but I am not very familiar with Java

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That said I would happily accept a cleaner approach!

Copy link

@TimurSadykov TimurSadykov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, forgot to post few nit comments

@nnl-1
Copy link

nnl-1 commented Oct 26, 2022

It seems I've been also affected by this. What exactly I should update? I don't see neither google-auth-library nor com.google.auth in my dep. tree.

@TimurSadykov
Copy link

@nnl-1 Please share what kind of client are you using where you see the issue and how you check the dependency tree?

@nnl-1
Copy link

nnl-1 commented Oct 28, 2022

@nnl-1 Please share what kind of client are you using where you see the issue and how you check the dependency tree?

@TimurSadykov I'm using this dep. https://mvnrepository.com/artifact/com.google.cloud.sql/postgres-socket-factory. The dep. tree command is 'mvn dependency:tree'.

@nnl-1
Copy link

nnl-1 commented Nov 1, 2022

ok, now I see it — GoogleCloudPlatform/cloud-sql-jdbc-socket-factory@c6df99f. Thanks

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

Labels

size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants