Skip to content

Suppress the fork-orphaned IoLoop thread block in nightly Valgrind - #1121

Merged
Yaraslaut merged 1 commit into
masterfrom
fix/nightly-valgrind-gallery
Nov 15, 2026
Merged

Yaraslaut merged 1 commit into
masterfrom
fix/nightly-valgrind-gallery

Conversation

@Yaraslaut

Copy link
Copy Markdown
Member

#1093 Valgrind memcheck

Root cause (reproduced the mechanism locally, not the CI classification). The three failing processes are not the test suite itself: they are the fork() children of tests/test_registration_phase.cpp (runRegistrarInChild), one per "control" case, and the child's _exit triggers a leak check. A child inherits the parent's heap but only the forking thread. Earlier in the run test_chat_origin.cpp had created a static TimeoutScheduler whose IoLoop thread is still running; the 24-byte std::thread state block it owns is referenced only from that thread's stack, which the child does not have. Nothing in the child can reach it, so Valgrind 3.22 (CI) reports it definitely lost. The library does not leak: in the parent the thread frees the block, and a run of the chat-origin tests alone and of all [chat] tests under the CI flags is clean (0 bytes in use at exit).

Fix. A suppression in cmake/valgrind.supp, narrowed to the three-frame stack operator new / std::thread::thread<...IoLoop...> / IoLoop::IoLoop, with the reasoning in a comment. Frames are matched by mangled name (demangled patterns did not match; verified).

Evidence.

  • Local run --order lex of the chat-origin test plus [registration-phase] forks six children; in each, the same stack and 24-byte block exists (classified "still reachable" locally by Valgrind 3.25.1, "definitely lost" on CI's 3.22).
  • Control: with a copy of the suppression widened to definite,reachable, -s reports used_suppression: 1 ioloop_thread_state_orphaned_by_fork ... suppressed: 24 bytes in 1 blocks in each of the six children. So the frames match the block. The suppression as committed (definite only) is therefore expected to silence CI's report.

Not verified. I could not reproduce the "definitely lost" classification here (Arch host, Valgrind 3.25.1; needed DEBUGINFOD_URLS for ld.so symbols), so the before/after on the committed suppression is inferred from the widened control, not observed on 3.22. I did not run the whole suite under Valgrind (15-60 min).

#1089 all optional features: no change

On current master (4e99bac), gcc-debug with NET, QT, QT_QUICK, LADDER=all and EXAMPLES on, built target lims_gallery_render_smoke and ran it with QT_QPA_PLATFORM=offscreen:

All tests passed (9 assertions in 1 test case)

(no needs N px message). The nightly ran on 2f2b4a0, before #1112, which changed src/qt_quick/table.cpp, widget.cpp and others. This is not a fix of mine and not proof it is fixed in CI: the nightly uses Qt 6.8.1 and clang+gcc, the local run used the system Qt on gcc only, and row heights depend on font metrics. So #1089 is not closed here; the next nightly on master decides.

Review (inline): the only change is a suppression entry; it matches only definite leaks with an IoLoop thread-state allocation stack.

Closes #1093

🤖 Generated with Claude Code

https://claude.ai/code/session_01No1Nzo5wbYPDDynGBphgqj

…t 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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01No1Nzo5wbYPDDynGBphgqj
@Yaraslaut
Yaraslaut merged commit f9accaf into master Nov 15, 2026
14 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: nightly Valgrind memcheck failed

1 participant