-
Notifications
You must be signed in to change notification settings - Fork 268
Closed
Labels
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.status: investigatingThe issue is under investigation, which is determined to be non-trivial.The issue is under investigation, which is determined to be non-trivial.
Description
We are seeing a possible race condition around credential refresh. We use the following code in an integration test suite to fetch OAuth2 tokens:
GoogleCredentials credentials = ...;
try {
if (forceRefresh) {
credentials.refresh();
} else {
credentials.getRequestMetadata();
}
AccessToken token = credentials.getAccessToken();
return token.getTokenValue();
} catch (IOException e) {
throw new RuntimeException(e);
}We expect the credentials to contain a valid access token at the end of the if-else block. However, our tests intermittently fail by throwing a NullPointerException at token.getTokenValue(). Any thoughts on what might be going on here? What should we do to ensure that getAccessToken() always returns a non-null value?
Note: In the failing tests, forceRefresh has been set to false. So it should execute the credentials.getRequestMetadata() path.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.status: investigatingThe issue is under investigation, which is determined to be non-trivial.The issue is under investigation, which is determined to be non-trivial.