-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
in_exec with out_exec in one config create file descriptors leak #3627
Comments
It seems that it is reproducible with a more simple in_exec example. it may also reproducible for out_exec side.
|
I fixed get_memory_metrics.sh in my example which did not work, prinf part was missing. I am gonna try your example, but I was not able to reproduce this when having only in_exec or out_exec in config, both had to be present. |
Yea, I can confirm that your example causes this too. So its not the combination of both that causes this. EDIT: wrong, it was too soon to judge |
I am sorry, it was too soon to judge, it has stabilized on around 174 of FDs. So my first thought still applies, I observe only the combination of both in_exec and out_exec to cause infinite rising of FDs. |
This issue has been automatically marked as stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 30 days |
Bump. |
I checked it but can't reproduce. fluent.conf <system>
process_name fluentd_monitor
</system>
<source>
@type exec
tag hardware.memory
run_interval 10s
command /home/aho/Projects/Fluentd/fluentd/issues/3627-exec-memleak/get_memory_metrics.sh
<parse>
@type json
types mem_available:float,swap_total:float,swap_free:float
</parse>
</source>
<filter hardware.memory>
@type record_transformer
enable_ruby
<record>
time_local ${time.strftime('%Y-%m-%dT%H:%M:%S%z')}
</record>
</filter>
<match hardware.memory>
@type exec
command /home/aho/Projects/Fluentd/fluentd/issues/3627-exec-memleak/psql_memory.sh
<format>
@type csv
force_quotes false
delimiter |
fields time_local,mem_available,swap_total,swap_free
</format>
<buffer time>
@type file
path /home/aho/Projects/Fluentd/fluentd/issues/3627-exec-memleak/hardware.memory.buff
timekey 50s
timekey_wait 0s
flush_mode lazy
total_limit_size 200MB
retry_type periodic # exponential backoff is broken https://github.com/fluent/fluentd/issues/3609
retry_max_times 0 # need to go to secondary as soon as possible https://github.com/fluent/fluentd/issues/3610
</buffer>
</match> get_memory_metrics.sh: #!/bin/bash
mem_info=$(awk '{ \
if (/MemAvailable:/) {mem_available=$2}; \
if (/SwapTotal:/) {swap_total=$2}; \
if (/SwapFree:/) {swap_free=$2}; \
if (mem_available && swap_total && swap_free) \
{printf "%.3f %.3f %.3f", mem_available/1024/1024, swap_total/1024/1024, swap_free/1024/1024;exit} \
}' /proc/meminfo)
read -r mem_available swap_total swap_free<<<"${mem_info}"
printf '{"mem_available":"%s","swap_total":"%s","swap_free":"%s"}' \
"$mem_available" \
"$swap_total" \
"$swap_free" ( psql_memory.sh:
Environment:
Results:
Count of fd is always |
It might depend on installed gems (low possibility though), please try updating them. |
I dont see any difference in script you posted? There is bash shebang as well in my version of the script. Only difference I see is that you are missing secondary section. Could you try that with that? The {{ home }} was meant to be rewritten according to you environment. I will try again later and post if I still observe the problem. |
Also did you try |
I also tried
I tried it every 1 sec for 2 hours. |
I still see the problem even with version 1.15.1. Roughly after 10 minutes there is 90 in my case, after 20 minutes 160. 30 minutes 233 and so on...
|
I use vagrant in this example, but I have seen this in rented KVM cloud. |
Thanks, it reproduced on Rocky Linux 8:
|
Analyzed data by fluent-plugin-sigdump: They aren't decreased even after major GC is triggered. |
Pipes for child processes aren't closed explicitly after exiting child processes. Fix #3627 Signed-off-by: Takuro Ashie <ashie@clear-code.com>
With #3844 file descriptor leak seems fixed, but still following objects are linearly incremented: |
Pipes for child processes aren't closed explicitly after exiting child processes. Fix #3627 Signed-off-by: Takuro Ashie <ashie@clear-code.com>
Although file descriptor leak is resolved, not yet resolved the problem described above. |
Hi, any luck on this one? |
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days |
I think this is still not solved completely... |
This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days |
I think this is still not solved completely... |
Describe the bug
Hello, I think I have found the core issue of my problems with fluentd configuration, could someone have look on this please?
I have set everything according to https://docs.fluentd.org/installation/before-install.
Using configuration and two scripts below I can notice that if I do these for a while:
Then I can see that number of file descriptors is rising infinitely eventually resulting in memory problems and "too many open files" error because of reaching fd limit (ulimit -n). This only occures if both in_exec and out_exec are used, since if I do following swaps, the number of file descriptors stabilizes. I can do either of these and the problems will disappear.
File descriptors count is stabilized if I swap match section for this:
or swap source and filter section for this:
To Reproduce
Install fluentd:
gem install fluentd --version 1.14.5 --no-doc
Create folder "fluentd" in home folder
Exchange {{ home }} or {{ user }} for your real values in every file below.
Put fluentd.conf (with configuration below), get_memory_metrics.sh, psql_memory.sh into {{ home }}/fluentd/
do chmod +x on get_memory_metrics.sh, psql_memory.sh
run {{ home }}/bin/fluentd 1.14.5 -c {{ home }}/fluentd/fluentd.conf -vv
Now start checking the file descriptors in
/proc/<fluentd PID>/
with:find fd | wc -l
Keep cheking it for some time, youll see the count of file descriptors never stops rising.
Hopefully I did not miss anything.
Expected behavior
Number of file descriptors is not rising infinitely and not causing memory leaks.
Your Environment
Your Configuration
Your Error Log
No errors in fluentd.log using --v
Additional context
get_memory_metrics.sh
psql_memory.sh
The text was updated successfully, but these errors were encountered: