-
Notifications
You must be signed in to change notification settings - Fork 201
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
Support configuring credential timeouts separately from client timeouts #2086
Comments
Problem 😢To sum up, the biggest issue here is that setting let sdk_config = aws_config::load_from_env().await;
let dynamodb_client = aws_sdk_dynamodb::Client::from_conf(
aws_sdk_dynamodb::config::Builder::from(&sdk_config)
.retry_config(aws_config::retry::RetryConfig::disabled())
.timeout_config(
aws_config::timeout::TimeoutConfig::builder()
.operation_timeout(Duration::from_millis(50)) // <-- 50ms is enough for a DynamoDB query but not for the "lazy_load_credentials" span
.build(),
)
.build(),
); Random idea to fix this issue and improve the SDK 💡Something that would be awesome for both the developers and the users of the application built using the AWS SDK, would be to load credentials in another thread (not the |
👋 @jdisanti Does this discussion about a new SDK feature resolve this issue? Or is the |
The operation timeout still wraps identity resolution in the latest release, and given the architecture, I don't think we're going to be able to separate this out. I'm thinking what we need to do to solve your problem is add an eager credentials cache that uses a background task to continually refresh credentials before they expire so that that refresh happens in a separate thread, and thus, doesn't impact your requests at all. Unfortunately, we won't be able to get to this quickly, but you can unblock yourself by providing a custom caching implementation via the |
Thank you very much for this clear answer :) Now what about |
If I understand your problem correctly, I think you should be able to set both the connect and read timeouts without any issue. The identity resolution gets included in the operation timeout and operation attempt timeout, but not in the connect/read timeouts. I think that if you set the connect/read timeouts as part of the SdkConfig, then they will also be applied to the HTTP client that the credentials provider uses, but it sounds like that won't be an issue for you. |
Since the identity cache loading takes around And if I understood correctly what you said, it sounds like we can't do that. |
The connect/read timeouts occur at the HTTP client/connector level, so they don't include the identity resolution time. You should be able to safely set them that low. Just note that they will apply to any HTTP operations made inside of that identity resolver if you're using the default credentials chain. But it's only for the HTTP connect/read time, and not for the entire operation. |
I found this issue while trying to figure out how to increase the default five second timeout for invoking the credentials process. At best, the credentials process I use, saml2aws, takes about ten seconds, at worst, saml2aws does a two factor handshake with a human and I want to allow my humans a long time to respond. What is working for me is this: use aws_config::{identity::IdentityCache, BehaviorVersion, SdkConfig};
let base = aws_config::defaults(BehaviorVersion::latest()).identity_cache(
IdentityCache::lazy()
.load_timeout(Duration::from_secs(90))
.build(),
); I am not aware of this having any unfortunate side effects, but I don't know what side effects to look for 🤷🏻. |
Just wanted to chime in here that I was having a similar problem to @bruceadams, his solution is working for me as well (thanks!) I wonder if it might be reasonable to treat Maybe another option would be to allow specifying the timeout in the same place that the process credential provider is initially configured, e.g. in |
See awslabs/aws-sdk-rust#681 for the use-case. It should be more obvious how to configure credential timeouts separately from client timeouts.
The text was updated successfully, but these errors were encountered: