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

engine_dispatch: remove chunks from memory if the task fails to be created #8681

Merged
merged 2 commits into from
Apr 8, 2024

Conversation

seblaz
Copy link
Contributor

@seblaz seblaz commented Apr 8, 2024

When a task is not created and the filesystem storage is used, then set the chunk down

Fixes #8395 #7329 #5485 #5217


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

  • [N/A] Example configuration file for the change
  • [N/A] Debug log output from testing the change
  • [N/A] 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.

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

Documentation

  • [N/A] Documentation required for this feature

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.

seblaz added 2 commits April 8, 2024 10:18
…eated

When the tasks_map is filled and the new arriving chunks try to create a new
task, then an error is returned. Additionally, under that condition the new
chunks don't get deleted from memory, and they occupy a space of the
storage.max_chunks_up. Eventually, the new chunks end up using the entire space
of the storage.max_chunks_up. This causes the old chunks that have a task
assigned to be unable to be brought up into memory, and therefore they never
get flushed.

This pr fixes the problem by deleting the new chunks from memory in case they
failed to create a task and the filesystem storage is in use. Additionally, it
runs a check to not bring it up to memory in the first place if possible.

Signed-off-by: seblaz <[email protected]>
(cherry picked from commit 5a7bbdf)
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.

@edsiper merge ASAP.

@edsiper edsiper merged commit a4cdf37 into fluent:2.2 Apr 8, 2024
15 checks passed
@seblaz seblaz deleted the 2.2 branch April 8, 2024 20:24
@jacob-faber
Copy link

jacob-faber commented Apr 24, 2024

@edsiper Any ETA for 2.2.4 release?

@Ikonovich
Copy link

Hey there, this change likely introduced a regression.
The issue: When an output is blocked (in my case, due to an internet outage), tasks are still created to handle chunks. Eventually, this hits 2048 tasks, and no more can be created. Each of these tasks puts their chunk down.

During this time, the input pulls up chunks, and tries to create tasks for them. Because the tasks are full, it can't create any tasks, but leaves these chunks in memory.

The engine continually retries the output tasks, but since there is no free memory, it can't pull any chunks up.

So:
The input consumes all memory, and can't create any tasks.
The output consumes all tasks, but can't allocate memory to them.
This deadlocks the agent, resulting in constant task re-scheduling messages. Unblocking the output does not have any effect.

I was able to resolve this issue by giving outputs a small virtual memory reserve that the input doesn't have access to, allowing them to always be able to bring up at least one chunk into memory. This breaks the deadlock, allows the resources to be cleared, and allows the operation to proceed.

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.

5 participants