-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[Secure Storage] Update vault request timeout and error handling. #7193
Conversation
secure/storage/vault/src/lib.rs
Outdated
const TIMEOUT: u64 = 10_000; | ||
/// Request timeouts for vault operations. | ||
const CONNECT_TIMEOUT_MILLISECS: u64 = 3000; | ||
const TIMEOUT_MILLISECS: u64 = 5000; |
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.
How much work would it be to make these configurable?
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.
Per component? e.g., using the config files, I believe a PR was previously started last year but never landed (#5229). Given the amount of code for this, do we think configurable timeouts would be that useful?
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.
In the Vault backend
config section (wherever that gets used). Yes, timeouts are almost always configurable and do get used :-) If they are configurable we can set fairly aggressive defaults, but if that causes issues we can tune them in deployments. If they're hardcoded they have to be much more conservative.
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.
That's fair -- if you can see the benefit then I'm happy to do that. Will probably have to do it as a follow up though -- might be too far beyond the scope of this PR 😄
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 think you can attach it as another commit to this PR or you can keep the values at 10_000.
I'm not comfortable changing values without having knobs at this point.
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.
Agreed, I've changed them to 10_000 and will then follow up with a configurable timeout PR (I think this will be cleaner/easier to manage).
secure/storage/vault/src/lib.rs
Outdated
let status = resp.status(); | ||
let status_text = resp.status_text().to_string(); | ||
match resp.into_string() { | ||
Ok(body) => Error::HttpError(status, status_text, body), | ||
Err(e) => Error::InternalError(e.to_string()), | ||
Err(error) => Error::SerializationError(error.to_string()), |
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.
why is this a serialization error? I think this is an internal error. Same with above.
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.
Sure, although I preferred SerializationError as internally "resp.into_string()" performs serialization of the response (e.g., unchunking of the response bytes and using from_utf8_lossy), so if the call fails, it's a SerializationError. But granted, this is internal to the "resp.into_string()". Happy to revert to "InternalError" or perhaps something else, e.g., "ResponseConversionError"?
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 wouldn't say UTF8 from bytes is serialization in the traditional sense. I guess the question is when would this result in an error? Since it isn't well defined, I called it an internal error. A more accurate statement might be "ResponseParsingError" ? yuck :P
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.
Actually I'm 100% certain that this should be an internal error, for example, this could be caused by a terminated connection. I'll accept with the assumption we'll revert these back.
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.
Okay, cool, thanks @davidiw -- sounds good!
7affe2f
to
3a2efd9
Compare
Thanks @davidiw 😄 |
Cluster Test Result
Repro cmd:
🎉 Land-blocking cluster test passed! 👌 |
💔 Test Failed - commit-workflow |
/land |
Cluster Test Result
Repro cmd:
🎉 Land-blocking cluster test passed! 👌 |
Motivation
This PR offers 3 small improvements to the vault secure storage client:
Have you read the Contributing Guidelines on pull requests?
Yes.
Test Plan
All tests pass locally.
Related PRs
None, but these changes come as a result of the on-going investigation of: https://github.com/diem/partners/issues/727