From 989c5d4c418d168b0bdb5df39c78b752e6d1cf9f Mon Sep 17 00:00:00 2001 From: Yaraslau Tamashevich Date: Sat, 14 Nov 2026 21:53:18 +0100 Subject: [PATCH] Suppress the IoLoop thread-state block that a forked test child cannot reach The registration-phase test forks the test process. The child inherits the heap but only the forking thread, so the state block of a std::thread that a long-lived IoLoop (the shared TimeoutScheduler in test_chat_origin) still owns at the fork is referenced from nowhere in the child and Valgrind reports it definitely lost at the child's _exit. Co-Authored-By: Claude Sonnet 5.5 Claude-Session: https://claude.ai/code/session_01No1Nzo5wbYPDDynGBphgqj --- cmake/valgrind.supp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cmake/valgrind.supp b/cmake/valgrind.supp index 0f4a05123..9ebd1913b 100644 --- a/cmake/valgrind.supp +++ b/cmake/valgrind.supp @@ -19,3 +19,21 @@ obj:*morph_tests* fun:_dl_init } + +# A forked child inherits the parent's heap but only the forking thread. The +# state block of a std::thread owned by an IoLoop that was running at the fork +# is referenced only from that thread's stack, so in the child it is reported +# as definitely lost although the parent frees it when the thread ends. The +# registration-phase test forks from a process whose earlier tests may have +# left a long-lived IoLoop running; nothing in the child can reach the block. +# Frames are matched by mangled name. The three-frame stack is specific enough +# that a real IoLoop leak, which keeps a running thread and so a reachable +# block, is not masked. +{ + ioloop_thread_state_orphaned_by_fork + Memcheck:Leak + match-leak-kinds: definite + fun:_Znwm + fun:_ZNSt6threadC*IoLoop* + fun:_ZN5morph4exec6IoLoopC* +}