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

flb_aws_util: set max response buffer size for the http client #4047

Merged
merged 2 commits into from
Sep 7, 2021

Conversation

hossain-rayhan
Copy link
Contributor

@hossain-rayhan hossain-rayhan commented Sep 2, 2021

This change will enable unlimited response buffer for aws http client. In this way we can mitigate the following error for all AWS plugins including kinesis_firehose and s3.

[ warn] [http_client] cannot increase buffer: current=4096 requested=36864 max=4096

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

  • [ N/A] Example configuration file for the change
  • [ X] Debug log output from testing the change
  • [ N/A] Attached Valgrind output that shows no leaks or memory corruption was found

Documentation

  • [ N/A] Documentation required for this feature

Debug log for this change

[2021/09/02 23:50:55] [debug] [aws_http_client] max response buffer size was increased to 0
[2021/09/02 23:50:55] [debug] [upstream] KA connection #83 to firehose.us-west-2.amazonaws.com:443 is now available
[2021/09/02 23:50:55] [debug] [output:kinesis_firehose:kinesis_firehose.0] PutRecordBatch http status=200
[2021/09/02 23:50:55] [debug] [output:kinesis_firehose:kinesis_firehose.0] Sent events to fluent-bit-perf-test
[2021/09/02 23:50:55] [debug] [output:kinesis_firehose:kinesis_firehose.0] Sending 500 records
[2021/09/02 23:50:55] [debug] [output:kinesis_firehose:kinesis_firehose.0] Sending log records to delivery stream fluent-bit-perf-test

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.

src/aws/flb_aws_util.c Outdated Show resolved Hide resolved
src/aws/flb_aws_util.c Outdated Show resolved Hide resolved
src/aws/flb_aws_util.c Outdated Show resolved Hide resolved
src/aws/flb_aws_util.c Outdated Show resolved Hide resolved
PettitWesley
PettitWesley previously approved these changes Sep 3, 2021
@PettitWesley
Copy link
Contributor

Squash commits and check DCO

src/aws/flb_aws_util.c Outdated Show resolved Hide resolved
krispraws
krispraws previously approved these changes Sep 3, 2021
Copy link
Contributor

@krispraws krispraws left a comment

Choose a reason for hiding this comment

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

Thank you!

@@ -309,6 +310,11 @@ struct flb_http_client *request_do(struct flb_aws_client *aws_client,
goto error;
}

/* Increase the maximum HTTP response buffer size to fit large responses from AWS services */
if (flb_http_buffer_size(c, FLB_MAX_AWS_RESP_BUFFER_SIZE)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So there are two problems here:

  1. this function returns -1 when it fails and that actually evaluates to true IIRC
  2. also, fluent bit code style says you can't call a function inside an if condition

So you need to do:

ret = flb_http_buffer_size(c, FLB_MAX_AWS_RESP_BUFFER_SIZE);
if (ret == -1) {

Copy link
Contributor

Choose a reason for hiding this comment

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

Use ret != 0 instead of ret == -1

@edsiper edsiper merged commit b77b0c4 into fluent:master Sep 7, 2021
edsiper pushed a commit that referenced this pull request Sep 7, 2021
* flb_aws_util: set max response buffer size for the http client

Signed-off-by: Rayhan Hossain <[email protected]>
PettitWesley pushed a commit to PettitWesley/fluent-bit that referenced this pull request Sep 8, 2021
)

* flb_aws_util: set max response buffer size for the http client

Signed-off-by: Rayhan Hossain <[email protected]>
pwhelan pushed a commit to pwhelan/fluent-bit that referenced this pull request Sep 16, 2021
)

* flb_aws_util: set max response buffer size for the http client

Signed-off-by: Rayhan Hossain <[email protected]>
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.

4 participants