Skip to content

Commit

Permalink
child_process: Plug file descriptor leak
Browse files Browse the repository at this point in the history
Pipes for child processes aren't closed explicitly after exiting child
processes. Should't rely on GC, close immediately as soon as it isn't
needed to avoid exhausting file descriptors.

Signed-off-by: Takuro Ashie <ashie@clear-code.com>
  • Loading branch information
ashie committed Aug 9, 2022
1 parent 0ee8322 commit 788cf89
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/fluent/plugin_helper/child_process.rb
Expand Up @@ -346,6 +346,9 @@ def child_process_execute_once(
if cb
cb.call(process_info.exit_status) rescue nil
end
process_info.readio&.close rescue nil
process_info.writeio&.close rescue nil
process_info.stderrio&.close rescue nil
end
thread[:_fluentd_plugin_helper_child_process_running] = true
thread[:_fluentd_plugin_helper_child_process_pid] = pid
Expand Down

0 comments on commit 788cf89

Please sign in to comment.