summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2025-10-10 19:27:08 -0400
committerPeter Zhu <peter@peterzhu.ca>2025-10-11 18:03:17 -0400
commit89dc79eeba9b450d2cc921b428fd4519f5e04690 (patch)
tree9329e463150204f1cb4a01198d0cd73a87ac1751
parentd036dc0a794d87309f912e7585749c681c2438f5 (diff)
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.
-rw-r--r--tool/lib/core_assertions.rb7
1 files changed, 7 insertions, 0 deletions
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