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

handle async error #225

Merged
merged 10 commits into from
Nov 2, 2022
Merged

handle async error #225

merged 10 commits into from
Nov 2, 2022

Conversation

TingDaoK
Copy link
Contributor

@TingDaoK TingDaoK commented Oct 28, 2022

Issue #, if available:

Description of changes:

  • For CompleteMultipartUpload, that mentioned with async error code, which is the only API we called from GET/PUT/COPY that will ever has async error, we parse the body and get the error code if there.
  • If error is InternalErrors, we do retry on the request. Other errors fall into non-retryable Error.

TODO: Don't have tests for the corner case.

Note: The default type may receive async error as well. CRT S3 client DO NOT handle those, and never will parse the body for default type of meta request. It's the caller's responsibility to handle it properly. -> #233

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@TingDaoK TingDaoK marked this pull request as ready for review October 31, 2022 16:30
include/aws/s3/private/s3_util.h Show resolved Hide resolved
@@ -158,6 +158,15 @@ extern const struct aws_byte_cursor g_head_method;
AWS_S3_API
extern const struct aws_byte_cursor g_delete_method;

AWS_S3_API
Copy link
Contributor

Choose a reason for hiding this comment

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

do we really need to expose those in api?

include/aws/s3/private/s3_meta_request_impl.h Outdated Show resolved Hide resolved
source/s3_meta_request.c Show resolved Hide resolved
struct aws_string *get_top_level_xml_tag_value(
struct aws_allocator *allocator,
const struct aws_byte_cursor *tag_name,
struct aws_byte_cursor *xml_body);

/* Get a top-level (exists directly under the root tag) tag value with expected root name. */
AWS_S3_API
struct aws_string *get_top_level_xml_tag_value_with_root_name(
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: it feels a bit awkward that function is checking the expected name. return root name and value pair instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmmm, it's a non-public helper function. I feel either way is kind awkward from the use case...

It serves the use case of getting the error code from the body if exist. If the function is as you suggested, we cannot tell the difference between an real failure or the body is a success response that don't have the tag.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should really come up with a better way to test helper functions without exposing them in the library interface.

Anyways, im fine with it with the new naming

allocator,
tag_name,
expected_root_name,
&root_name_mismatch,
Copy link
Contributor

Choose a reason for hiding this comment

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

minor: can just pass in out variable here

/* Check the error code. Map the S3 error code to CRT error code. */
int error_code = aws_s3_crt_error_code_from_server_error_code_string(error_code_string);
if (error_code != AWS_ERROR_S3_INTERNAL_ERROR) {
/* All error besides of internal error from async error doesn't recoverable from retry for now. */
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: doesn't -> are not

@TingDaoK TingDaoK enabled auto-merge (squash) November 2, 2022 20:39
@TingDaoK TingDaoK enabled auto-merge (squash) November 2, 2022 21:41
@TingDaoK TingDaoK merged commit e6a8ff9 into main Nov 2, 2022
@TingDaoK TingDaoK deleted the async-error-code branch November 2, 2022 21:52
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.

2 participants