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

process_exporter input plugin does not handle dead processes #9547

Open
PromyLOPh opened this issue Nov 4, 2024 · 0 comments
Open

process_exporter input plugin does not handle dead processes #9547

PromyLOPh opened this issue Nov 4, 2024 · 0 comments

Comments

@PromyLOPh
Copy link

PromyLOPh commented Nov 4, 2024

Bug Report

Describe the bug
The process_explorer input plugin only adds data to its own internal state (like flb_pe.memory_bytes), but never removes data from dead processes. If running for a long time, this leads to high memory usage, because old process data is never pruned, and high CPU usage, because cmetric’s metric_hash_lookup function is not actually a hash lookup, but linear search. With a growing number of stale process entries for each metric the fluent-bit process will end up spending most of its time doing this search.

To Reproduce

  • Run fluent-bit -p scrape_interval=1 -i process_exporter_metrics -o stdout
  • Run while true; do for i in $(seq 100); do sleep 5 & done; sleep 5; done at the same time to create alot of short-lived processes.
  • Wait about 10–15 minutes.
  • Observe increasing CPU and memory usage of the fluent-bit process via htop or similar. Run ptrace record -p <pid> to capture profiling data for a few seconds, run ptrace report and note that the function metric_hash_lookup is on the top of the list.

Expected behavior
CPU and memory usage stays the same.

Your Environment

  • Version used: 3.1.4 and latest master (commit 104aceb)
  • Configuration: (none)
  • Environment name and version (e.g. Kubernetes? What version?): (none)
  • Server type and version: (none)
  • Operating System and version: Debian 12
  • Filters and plugins: plugin_exporter_metrics and stdout

Additional context
fluent-bit’s process_exporter plugin is basically unusable on low-end embedded devices. Also note that during testing fluent-bit might crash due to a different bug (see #9548).

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