Skip to content
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 smithy client retry handling #3160

Merged
merged 2 commits into from
Oct 24, 2024
Merged

Conversation

SergeyRyabinin
Copy link
Contributor

@SergeyRyabinin SergeyRyabinin commented Oct 23, 2024

Issue #, if available:
The retry handling was broken on the smithy request pipeline
Description of changes:
Do no immediately call the response handler in case of error, go through retry loop first
Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sbiscigl sbiscigl force-pushed the smithy/fix_retry_logic branch from dcaed4c to 9204992 Compare October 23, 2024 20:24
pRequestCtx->m_endpoint.GetAttributes()->authScheme.GetSigningRegion().value() : "";
const Aws::String signerRegion = [&]() {
if (!regionFromResponse.empty() &&
pRequestCtx->m_endpoint.GetAttributes() &&
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the problem here was that lack of the check for an Optional pRequestCtx->m_endpoint.GetAttributes()
which is not always set.

AWS_LOGSTREAM_DEBUG(AWS_SMITHY_CLIENT_LOG, "Request returned error. Attempting to generate appropriate error codes from response");
assert(m_errorMarshaller);
auto error = m_errorMarshaller->BuildAWSError(httpResponse);
return HttpResponseOutcome(std::move(error));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the main diff here is to not perform early return

return pRequestCtx->m_responseHandler(HttpResponseOutcome(std::move(error)));

but I also used IIFE to avoid modification of the other blocks by keeping the original variable Aws::Client::HttpResponseOutcome outcome

@SergeyRyabinin SergeyRyabinin marked this pull request as ready for review October 23, 2024 21:13
@sbiscigl sbiscigl force-pushed the smithy/fix_retry_logic branch from 9204992 to 8be9734 Compare October 23, 2024 22:03
@SergeyRyabinin SergeyRyabinin merged commit 7d24bbd into main Oct 24, 2024
4 checks passed
@SergeyRyabinin SergeyRyabinin deleted the smithy/fix_retry_logic branch October 24, 2024 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants