From 89dc79eeba9b450d2cc921b428fd4519f5e04690 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 10 Oct 2025 19:27:08 -0400 Subject: Ignore thread not suspended warning messages in LSAN When a process with multiple threads is forked, LSAN outputs warning messages to stderr like: ==276855==Running thread 276851 was not suspended. False leaks are possible. We should ignore messages like this in tests. --- tool/lib/core_assertions.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index fc7b940284..7e6dc8e653 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -328,6 +328,13 @@ eom args.insert((Hash === args.first ? 1 : 0), "-w", "--disable=gems", *$:.map {|l| "-I#{l}"}) args << "--debug" if RUBY_ENGINE == 'jruby' # warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag stdout, stderr, status = EnvUtil.invoke_ruby(args, src, capture_stdout, true, **opt) + + if Test::Sanitizers.lsan_enabled? + # LSAN may output messages like the following line into stderr. We should ignore it. + # ==276855==Running thread 276851 was not suspended. False leaks are possible. + # See https://github.com/google/sanitizers/issues/1479 + stderr.gsub!(/==\d+==Running thread \d+ was not suspended\. False leaks are possible\.\n/, "") + end ensure if res_c res_c.close -- cgit v1.2.3