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

record_modifier BOOL_MAP_LIMIT memory leak #9954

Open
wiardvanrij opened this issue Feb 18, 2025 · 0 comments
Open

record_modifier BOOL_MAP_LIMIT memory leak #9954

wiardvanrij opened this issue Feb 18, 2025 · 0 comments

Comments

@wiardvanrij
Copy link

wiardvanrij commented Feb 18, 2025

Bug Report

We run fluentbit on K8s. On two pods from the 100's, we get this error: The number of elements exceeds limit 65535

It is happening on this filter:

    [FILTER]
        Name record_modifier
        Match *
        Remove_key xxx_docker_id
        Remove_key xxx_container_hash
        Remove_key xxx_labels_pod-template-hash
        Remove_key _p

I've looked a little bit at the code:

if (map_num > BOOL_MAP_LIMIT) {

and if I infer this correctly, it should mean I have that many elements in my log body?

To split this problem into two sections;

  1. I debugged and looked into the raw logs and could not find any log line that would have caused this error in the first place
  2. Regardless, let's assume we do; this is causing a memory leak. The two pods in question surpasses our buffer sizes and limits over time. Clearly indicating that something is staying in memory every time we hit this error.

Potentially:

At a first glance it seems to me that both exit paths in lines 372 and 378 do not dispose of neither the encoder nor the decoder and I'm fairly sure that at least the encoder part will leak the internal msgpack working buffer in this case

I'm unable to provide my full config as it contains many business specific things and we have some company policies. Like-wise as for my raw logs. Hopefully this is sufficient for now.

If anything, I moved this record_modifier into a plain modifier and that solves all our problems.

(we run on v2.2.x, which is old, but I do assume the logic on this part hasn't changed much)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant