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: apply back pressure if input threaded plugin is paused #7847

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

danlenar
Copy link
Contributor

Fixes only second scenario described in #7846

If a threaded input plugin is paused due to memory buf limits, dont read chunks/records from the ring buffer.
This will prevent this debug message from being logged.

[2023/08/21 20:35:35] [ info] [task]   task_id=36 still running on route(s): kafka/kafka.0
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records
[2023/08/21 19:55:57] [debug] [input chunk] tail.0 is paused, cannot append records

The fix should replicate similar back pressure as done in non-threaded input plugins.


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.

@danlenar danlenar temporarily deployed to pr August 21, 2023 22:36 — with GitHub Actions Inactive
@danlenar danlenar temporarily deployed to pr August 21, 2023 22:36 — with GitHub Actions Inactive
@danlenar danlenar temporarily deployed to pr August 21, 2023 22:37 — with GitHub Actions Inactive
@danlenar danlenar temporarily deployed to pr August 21, 2023 23:02 — with GitHub Actions Inactive
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.

I think that due to the decoupled nature of threaded input plugins we should actually drain the ring buffer regardless of the plugin instance state but I understand that this would be deeper change so this might be fine at least for the moment.

@danlenar
Copy link
Contributor Author

The other option is to remove this check for threaded plugins if you always want to drain the ring buffer regardless.
https://github.com/fluent/fluent-bit/blob/v2.1.8/src/flb_input_chunk.c#L1430

The only side effect is that mem_buf_limit then tends to have little impact for threaded input plugins.

Also, the triggering of that buffer is paused check in input_chunk_append_raw should be treated as a bug.
If back pressure is working correctly, then there shouldn't be a need to drop records due to a plugin being paused.
A properly paused plugin would have prevented input_chunk_append_raw from being triggered.

@edsiper edsiper merged commit 9cb07ca into fluent:master Sep 4, 2023
leonardo-albertovich pushed a commit that referenced this pull request Oct 5, 2023
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.

3 participants