-
Notifications
You must be signed in to change notification settings - Fork 850
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
Fix reload credentials not working when modified - external PR : #5185 #5259
Conversation
…redentials from a forked repo
Fix the build test failures d7cd3a0. The failures were not surfacing in local, as either config or credential file was set, which is not the case with CI build |
There is one test failure in recent build, it is due to new profileFile being created every time when config/credential file is not set. Resolve it in the commit fd04bab FYI @anirudh9391 |
Removed the unused import causing the checkstyle failure for auth module b737a7c FYI @anirudh9391 |
Removed unused imports from tests too, although not causing the failures 9088b59 |
generateTestCredentialsFile("modifiedAccess", "modifiedSecret"); | ||
|
||
// without sleep the assertion fails, as there is delay in config reload | ||
Thread.sleep(2000); |
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.
@anirudh9391 For Java8, the test is failing pos this, had included delay to ensure latest config is picked up, but it is failing occasionally,
Error: DefaultCredentialsProviderTest.resolveCredentials_DefaultCredentialProviderWithReloadWhenModified:126->lambda$resolveCredentials_DefaultCredentialProviderWithReloadWhenModified$7:127
expected: "modifiedAccess"
but was: "customAccess"
Should we increase the sleep value? Is there any alternative way to validate this?
For Java17, the test failures seems to be unrelated & from s3 module
2024-06-11T16:42:29.7804890Z [ERROR] Errors:
2024-06-11T16:42:29.7805324Z [ERROR] CrtDownloadErrorTest.verifyCrtResource:73 ? Runtime Timeout waiting for resource count to drop to zero
2024-06-11T16:42:29.7805829Z [ERROR] CrtCredentialProviderAdapterTest.verifyCrtResource:43 ? Runtime Timeout waiting for resource count to drop to zero
2024-06-11T16:42:29.7806270Z [ERROR] S3CrtClientWiremockTest.verifyCrtResource:92 ? Runtime Timeout waiting for resource count to drop to zero
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.
The Java17 error seems to be transient in nature. It seems to succeed locally. I will play around with timeout values a bit.
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.
Due to the caching of ProfileFile for short duration,
aws-sdk-java-v2/utils/src/main/java/software/amazon/awssdk/utils/cache/CachedSupplier.java
Line 242 in fb7b6ea
Instant newStale = now.plusSeconds(1); |
the credentials are not reloaded immediately, hence, Thread.sleep is required, added 2s sleep which in most cases sufficient, is not working in CI sometimes.
Here, sleep duration can be increased or assertion can retried with smaller timeout values
For reference, in ProfileRefresherTest
Line 134 in fb7b6ea
Duration refreshInterval = Duration.ofSeconds(15); |
Custom clock is used to advance the timer to validate refresh without sleep which might not be possible here, ie to set custom clock in ProfileSupplier
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.
I tried it with a 5 second delay. Seems to trip up the java21 and java8 builds, both of which fail assertion. Please feel free to cut another revision with any modifications to add retries or anything else. I think we can keep timeout at 5 seconds.
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.
I pushed another revision with a retry. Lets see if this works
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.
Seems like the retry failed all the java builds
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.
Thanks @anirudh9391 , will take a look. Going through the commit, I think retry should be added to second assertion, once credentials are modified
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.
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.
@anirudh9391 could you please cherry-pick latest commit for the fix, and further debugging?
Quality Gate passedIssues Measures |
Refer to external PR link : #5185