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

out_s3: fix tag corruption with preserve_data_ordering #6988

Merged
merged 4 commits into from
Mar 10, 2023

Conversation

PettitWesley
Copy link
Contributor

@PettitWesley PettitWesley commented Mar 9, 2023

Fixes #6933


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.

Copy link
Collaborator

@leonardo-albertovich leonardo-albertovich left a comment

Choose a reason for hiding this comment

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

Please address the flb_calloc errors.

@@ -105,7 +105,7 @@ static char *mock_error_response(char *error_env_var)

err_val = getenv(error_env_var);
if (err_val != NULL && strlen(err_val) > 0) {
error = flb_malloc(strlen(err_val) + sizeof(char));
error = flb_calloc(strlen(err_val) + sizeof(char));
Copy link
Collaborator

Choose a reason for hiding this comment

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

flb_calloc requires 2 paramters : element count and element size

In this case I'd suggest writing flb_calloc(strlen(err_val) + 1, sizeof(char))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed/Thanks!!!!

It is concerning that I

  1. have known how calloc works in the past
  2. self-code-reviewed this code to avoid embarrassing mistakes
  3. didn't catch it

:/

@@ -158,7 +158,7 @@ int create_headers(struct flb_s3 *ctx, char *body_md5,
return 0;
}

s3_headers = flb_malloc(sizeof(struct flb_aws_header) * headers_len);
s3_headers = flb_calloc(sizeof(struct flb_aws_header) * headers_len);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as 108, use headers_len as element count and the sizeof as element size

@leonardo-albertovich
Copy link
Collaborator

I just commented a few of those but there are quite a few. Additionally, I can't really review the string replacement modifications right now, it's too late and my brain is fried so either somebody else reviews it or I'll do it in the morning.

@PettitWesley PettitWesley force-pushed the s3-str-fixes-master branch from efeffdd to 5eab869 Compare March 9, 2023 23:30
@PettitWesley PettitWesley temporarily deployed to pr March 9, 2023 23:30 — with GitHub Actions Inactive
@PettitWesley PettitWesley temporarily deployed to pr March 9, 2023 23:31 — with GitHub Actions Inactive
@PettitWesley PettitWesley temporarily deployed to pr March 9, 2023 23:31 — with GitHub Actions Inactive
@PettitWesley
Copy link
Contributor Author

@leonardo-albertovich Sorry/thanks... I have fixed that calloc mistake... :/

@PettitWesley PettitWesley temporarily deployed to pr March 9, 2023 23:51 — with GitHub Actions Inactive
Copy link
Contributor

@matthewfala matthewfala left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@leonardo-albertovich
Copy link
Collaborator

Looks good to me too, all we are missing right now is a 2.0 backport, will you do it or should we? it'd be good if we merged the three of them at the same time just to keep things tidy

@PettitWesley
Copy link
Contributor Author

@leonardo-albertovich Sorry, when you said backport earlier I didn't realize we now have a 2.0 backport branch for 2.0 instead of 2.1. Sorry.

@leonardo-albertovich
Copy link
Collaborator

No worries I've already done it and merged all three of them together, thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

S3 output intermittently fails with errors SignatureDoesNotMatch, broken pipe, or HTTP version error
3 participants