Commit 2ce6d49
authored
test_buf_file: ensure to shutdown plugin instances (#5326)
**Which issue(s) this PR fixes**:
Fixes #
**What this PR does / why we need it**:
Same with #5325
Fix thread and resource leaks in test_buf_file.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/test_buf_file.rb'"
Loaded suite -e
Started
Finished in 2.152264481 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
37 tests, 204 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
17.19 tests/s, 94.78 assertions/s
--- Thread count at exit: 6
[#<Thread:0x00007f1812e67f68 run>,
#<Thread:0x00007f17f68df288@Timeout stdlib thread /home/watson/.rbenv/versions/4.0.2/lib/ruby/4.0.0/timeout.rb:87 sleep>,
#<Thread:0x00007f17f5bdc810@flush_thread_0 /home/watson/src/fluentd/lib/fluent/plugin_helper/thread.rb:70 sleep>,
#<Thread:0x00007f17f5bdc108@enqueue_thread /home/watson/src/fluentd/lib/fluent/plugin_helper/thread.rb:70 sleep>,
#<Thread:0x00007f17f5a02a30@flush_thread_0 /home/watson/src/fluentd/lib/fluent/plugin_helper/thread.rb:70 sleep>,
#<Thread:0x00007f17f5a026e8@enqueue_thread /home/watson/src/fluentd/lib/fluent/plugin_helper/thread.rb:70 sleep>]
```
After:
```
$ ruby -Ilib:test -e "at_exit { puts '--- Thread count at exit: ' + Thread.list.size.to_s; pp Thread.list }; require './test/plugin/test_buf_file.rb'"
Loaded suite -e
Started
Finished in 2.154188075 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
37 tests, 204 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
17.18 tests/s, 94.70 assertions/s
--- Thread count at exit: 2
[#<Thread:0x00007fc10b277fa8 run>, #<Thread:0x00007fc0eecec9d8@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>1 parent b5d5630 commit 2ce6d49
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
755 | 755 | | |
756 | 756 | | |
757 | 757 | | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
758 | 764 | | |
759 | 765 | | |
760 | 766 | | |
| |||
0 commit comments