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

input_chunk: restrict appending chunks greater than size limit #9995

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

braydonk
Copy link
Contributor

This PR is a second attempt at restricting input chunk sizes by splitting up input buffers in input_log_append based on the chunk max size. It also adds a companion configuration option storage.chunk_max_size to configure the max chunk size.

Detailed information can be found in the companion gist I wrote, which contains explanations of this solution, the other solutions I tried that failed, and testing methodology. https://gist.github.com/braydonk/f32256488e989c4e807b0f9ba69bebbb

Issues: #9374, #1938


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.

Adds a configuration value that can be used instead of
`FLB_INPUT_CHUNK_FS_MAX_SIZE` for the max size of an input chunk.

Signed-off-by: braydonk <braydonk@google.com>
Perform a check during `input_log_append` that will verify that the
passed buffer does not exceed the chunk max size. If that is the case,
the chunk will be split into multiple sets of data that are as big as
they can be before the chunk size limit to be appended separately.

Signed-off-by: braydonk <braydonk@google.com>
/* Send the events we have so far. */
ret = flb_input_chunk_append_raw(ins, FLB_INPUT_LOGS, in_records,
tag, tag_len,
out_buf + in_buf_start, in_buf_size);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Egg on my face, I never realized that arithmetic on void pointers is illegal in compilers other than GCC; GCC handles void a special way, making sizeof(void) = 1. I'll need to think of another way to do this to allow for other compilers to work.

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.

1 participant