From ed791141cae014fb6685b0c445cdc234cec48ef6 Mon Sep 17 00:00:00 2001 From: Daijiro Fukuda Date: Tue, 4 Mar 2025 18:05:44 +0900 Subject: [PATCH] test: fix Sigdump tests failure Sigdump.dump iterates ObjectSpace. If there are DoubleDefinition objects of RR, it can set some expectations of RR unexpectedly. It can cause test failure. By doing GC, we can remove DoubleDefinition objects made in other tests. See https://github.com/fluent/fluentd/issues/4063 Failure: test_cont_in_main_process_signal_handlers(SupervisorTest): class() Called 0 times. Expected 1 times. (...)/sigdump-0.2.5/lib/sigdump.rb:76:in `block in dump_object_count' (...)/sigdump-0.2.5/lib/sigdump.rb:75:in `each_object' (...)/sigdump-0.2.5/lib/sigdump.rb:75:in `dump_object_count' (...)/sigdump-0.2.5/lib/sigdump.rb:18:in `block in dump' (...)/sigdump-0.2.5/lib/sigdump.rb:138:in `open' (...)/sigdump-0.2.5/lib/sigdump.rb:138:in `_open_dump_path' (...)/sigdump-0.2.5/lib/sigdump.rb:14:in `dump' (...)/fluentd/fluentd/lib/fluent/supervisor.rb:1097:in `dump_non_windows' (...)/fluentd/fluentd/lib/fluent/supervisor.rb:997:in `block in install_main_process_signal_handlers' (...)/fluentd/fluentd/test/test_supervisor.rb:270:in `kill' (...)/fluentd/fluentd/test/test_supervisor.rb:270:in `test_cont_in_main_process_signal_handlers' 267: sv = Fluent::Supervisor.new({}) 268: sv.send(:install_main_process_signal_handlers) 269: => 270: Process.kill :CONT, Process.pid 271: 272: sleep 1 273: Signed-off-by: Daijiro Fukuda --- test/test_supervisor.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_supervisor.rb b/test/test_supervisor.rb index 2ad47a4070..51c344e669 100644 --- a/test/test_supervisor.rb +++ b/test/test_supervisor.rb @@ -264,6 +264,9 @@ def test_usr1_in_main_process_signal_handlers def test_cont_in_main_process_signal_handlers omit "Windows cannot handle signals" if Fluent.windows? + # https://github.com/fluent/fluentd/issues/4063 + GC.start + sv = Fluent::Supervisor.new({}) sv.send(:install_main_process_signal_handlers) @@ -279,6 +282,9 @@ def test_cont_in_main_process_signal_handlers def test_term_cont_in_main_process_signal_handlers omit "Windows cannot handle signals" if Fluent.windows? + # https://github.com/fluent/fluentd/issues/4063 + GC.start + create_debug_dummy_logger sv = Fluent::Supervisor.new({}) @@ -365,6 +371,9 @@ def test_usr1_in_supervisor_signal_handler def test_cont_in_supervisor_signal_handler omit "Windows cannot handle signals" if Fluent.windows? + # https://github.com/fluent/fluentd/issues/4063 + GC.start + server = DummyServer.new server.install_supervisor_signal_handlers @@ -380,6 +389,9 @@ def test_cont_in_supervisor_signal_handler def test_term_cont_in_supervisor_signal_handler omit "Windows cannot handle signals" if Fluent.windows? + # https://github.com/fluent/fluentd/issues/4063 + GC.start + server = DummyServer.new server.install_supervisor_signal_handlers