-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
output: allow records size 0 on flb event type logs processor #9554
Conversation
A chunk with no records is a valid case for logs (dropped all, etc) and must be processed in flush list. This patch allow record size to be == 0 in the case of FLB_EVENT_TYPE_LOGS Signed-off-by: Jorge Niedbalski <[email protected]>
@edsiper / @cosmo0920 seems stable / no chunk leaks for 15m or so. Appreciated suggestions on testing if required. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good and I have never imagined and though as not returned chunks cause memory leaks. This could be interesting behavior and we need to return when the size of chunks are zero. It won't be caused without processors but now we have processors. So, we need to change this behavior.
Description.
For full context, refer to #9553.
A chunk with no records is a valid scenario for logs (e.g., when all are dropped) and should either be added to the flush list or released immediately. However, the chunk should not attempt to flush.
This patch allows for the record size to be zero for
FLB_EVENT_TYPE_LOGS
.I created a basic processor that calls
flb_mp_chunk_cobj_record_destroy
on each record, resulting in a chunk with no records (size = 0). When this happens, coroutine tasks do not run, andfluentbit_storage_mem_chunks
continues to grow, causing a memory leak (refer to the issue report).With this configuration
Without this patch heap allocation graphs show continuous growth in heap memory allocations not being returned, with the chunk counter also incrementing in metrics.
With this patch enabled, chunks are released
Testing
Backporting
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.