test_child_process: ensure to shutdown plugin instances (#5331)
Which issue(s) this PR fixes: Fixes #
What this PR does / why we need it: Fix thread and resource leaks in test_output.rb by ensuring proper shutdown sequences for plugin instances.
Before:
$ ruby -Ilib:test -e "at_exit { puts '--- Thread count at exit: ' + Thread.list.size.to_s; pp Thread.list }; require './test/plugin_helper/test_child_process.rb'" Loaded suite -e Started P =========================================================================================================================================== Pending: test: can scrub characters without exceptions(ChildProcessTest): Behaviour of IO#set_encoding is changed as of Ruby 3.3 (#4058) /home/watson/src/fluentd/test/plugin_helper/test_child_process.rb:519:in 'block in <class:ChildProcessTest>' =========================================================================================================================================== P =========================================================================================================================================== Pending: test: can scrub characters without exceptions and replace specified chars(ChildProcessTest): Behaviour of IO#set_encoding is changed as of Ruby 3.3 (#4058) /home/watson/src/fluentd/test/plugin_helper/test_child_process.rb:545:in 'block in <class:ChildProcessTest>' =========================================================================================================================================== Finished in 34.07304912 seconds. ------------------------------------------------------------------------------------------------------------------------------------------- 33 tests, 96 assertions, 0 failures, 0 errors, 2 pendings, 0 omissions, 0 notifications 93.9394% passed ------------------------------------------------------------------------------------------------------------------------------------------- 0.97 tests/s, 2.82 assertions/s --- Thread count at exit: 3 [#<Thread:0x00007f49708b7f48 run>, #<Thread:0x00007f4954bb2908@event_loop /home/watson/src/fluentd/lib/fluent/plugin_helper/thread.rb:70 sleep>, #<Thread:0x00007f4954ba6310@Timeout stdlib thread /home/watson/.rbenv/versions/4.0.2/lib/ruby/4.0.0/timeout.rb:87 sleep>]After:
$ ruby -Ilib:test -e "at_exit { puts '--- Thread count at exit: ' + Thread.list.size.to_s; pp Thread.list }; require './test/plugin_helper/test_child_process.rb'" Loaded suite -e Started P =========================================================================================================================================== Pending: test: can scrub characters without exceptions(ChildProcessTest): Behaviour of IO#set_encoding is changed as of Ruby 3.3 (#4058) /home/watson/src/fluentd/test/plugin_helper/test_child_process.rb:524:in 'block in <class:ChildProcessTest>' =========================================================================================================================================== P =========================================================================================================================================== Pending: test: can scrub characters without exceptions and replace specified chars(ChildProcessTest): Behaviour of IO#set_encoding is changed as of Ruby 3.3 (#4058) /home/watson/src/fluentd/test/plugin_helper/test_child_process.rb:550:in 'block in <class:ChildProcessTest>' =========================================================================================================================================== Finished in 34.153673569 seconds. ------------------------------------------------------------------------------------------------------------------------------------------- 33 tests, 96 assertions, 0 failures, 0 errors, 2 pendings, 0 omissions, 0 notifications 93.9394% passed ------------------------------------------------------------------------------------------------------------------------------------------- 0.97 tests/s, 2.81 assertions/s --- Thread count at exit: 2 [#<Thread:0x00007fb335e77fa8 run>, #<Thread:0x00007fb319d758b0@Timeout stdlib thread /home/watson/.rbenv/versions/4.0.2/lib/ruby/4.0.0/timeout.rb:87 sleep>]Docs Changes:
Release Note:
Signed-off-by: Shizuo Fujita fujita@clear-code.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Fluentd: Open-Source Log Collector
Fluentd collects events from various data sources and writes them to files, RDBMS, NoSQL, IaaS, SaaS, Hadoop and so on. Fluentd helps you unify your logging infrastructure (Learn more about the Unified Logging Layer).
Quick Start
Development
Branch
Prerequisites
gitshould be inPATH. On Windows, you can useGithub for WindowsandGitShellfor easy setup.Install dependent gems
Use bundler:
Run test
You can run specified test via
TESTenvironment variable:More Information
Security
A third party security audit was performed by Cure53, you can see the full report here.
See SECURITY to contact us about vulnerability.
Contributors:
Patches contributed by great developers.