Skip to content

qa: valgrind suppression fixes, replacing overly broad UnknownInlinedFun suppression - #69311

Merged
stzuraski898 merged 1 commit into
ceph:mainfrom
stzuraski898:wip-sz-77138-valgrindsupp-mgr-fix
Aug 17, 2026
Merged

stzuraski898 merged 1 commit into
ceph:mainfrom
stzuraski898:wip-sz-77138-valgrindsupp-mgr-fix

Conversation

@stzuraski898

@stzuraski898 stzuraski898 commented Jun 5, 2026 •

Copy link
Copy Markdown
Contributor

Introduced with other suppressions that were added to support unit tests for the Mgr, the genealized 'UnknownInlinedFun' suppression is overly broad and should be removed, with specific LTTng and Glibc suppressions added in its place.

Sample leaks, which are reachable and are detecting allocations for LTTng's file descriptor tracking system. It's allocated once at startup and intentionally kept alive for the lifetime of the process:

65,536 bytes in 1 blocks are still reachable
at malloc
by lttng_ust_fd_tracker_init.part.0 (fd-tracker.c:113)
by lttng_ust_fd_tracker_init
by lttng_ust_common_ctor
...
by lttng_ust__tracepoints__init

Similarly, glibc allocations that are made at startup and kept alive for the entire lifetime:

Multiple allocations from:
dlopen@@GLIBC_2.34
lttng_ust__tracepoints__init
_dl_open
dl_open_worker
_dl_map_new_object

As these instances aren't bugs, and are external library behaviors, they should be suppressed. Additionally we only want to suppress 'Still reachable' library allocations, not all leaks. The updated suppressions catch only the specific allocation made by libraries during initialization, allowing the Unit Tests in src/test/mgr/ to run under Valgrind without false positives.

Fixes: https://tracker.ceph.com/issues/77138

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands

You must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.

@github-actions github-actions Bot added the tests label Jun 5, 2026
@stzuraski898 stzuraski898 changed the title qa: valgrind suppression fixes for mgr unit tests, removing UnknownIn… qa: valgrind suppression fixes, replacing overly broad UnknownInlinedFun suppression Jun 5, 2026
@tchaikov
tchaikov self-requested a review June 8, 2026 13:49
Comment thread qa/valgrind.supp Resolved
Comment thread qa/valgrind.supp Resolved
@stzuraski898
stzuraski898 force-pushed the wip-sz-77138-valgrindsupp-mgr-fix branch from ff49c7c to d4b33e4 Compare June 25, 2026 21:36
@stzuraski898

Copy link
Copy Markdown
Contributor Author

Agreed that I swung the pendulum from over-broad to over-specific, the newest push should resolve your comments whenever you have time to review @tchaikov

Thanks!

@badone badone left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a minor concern about the comment. Otherwise, if Kefu is happy I'm happy with it.

Comment thread qa/valgrind.supp Resolved
@stzuraski898
stzuraski898 force-pushed the wip-sz-77138-valgrindsupp-mgr-fix branch from d4b33e4 to 92a07bd Compare July 7, 2026 22:03
@stzuraski898

Copy link
Copy Markdown
Contributor Author

@badone @tchaikov whenever yall have time to look everything over, I believe the most recent commit has addressed both issues. Thanks!

Comment thread qa/valgrind.supp Resolved
…linedFun

UnknownInlineFun is replaced by more specific suppressions to avoid overlap with other testing, while still suppressing the false positives found in Mgr unit tests

Fixes: https://tracker.ceph.com/issues/77138
Signed-off-by: stzuraski898 <[email protected]>
@stzuraski898
stzuraski898 force-pushed the wip-sz-77138-valgrindsupp-mgr-fix branch from 92a07bd to 446fdb2 Compare July 10, 2026 22:42
@badone

badone commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@tchaikov are you able to take another look please?

@tchaikov tchaikov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@tchaikov

tchaikov commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

@tchaikov are you able to take another look please?

@badone hi Brad, sorry i missed this. this change looks good to me know. just one thing standed out -- the dlopen@@GLIBC_2.34, but since we don't test on ancient distros releases like centos 8 or ubuntu 20.04, so we are safe.

@stzuraski898

Copy link
Copy Markdown
Contributor Author

jenkins test api

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath7-testing-20260811.152323-main.

@ljflores ljflores left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stzuraski898 in the latest teuthology runs, there is a valgrind leak in one of the tests. My understanding is that this PR should fix the broadness of the current suppressions, but still suppress everything. Is that right?

Testing ref: https://tracker.ceph.com/issues/79378

/a/skanta-2026-08-11_22:46:54-rados-wip-bharath7-testing-20260811.152323-main-distro-default-trial/458958/remote/trial008/log/valgrind/osd.8.log.gz

<error>
  <unique>0x31c5b</unique>
  <tid>1</tid>
  <kind>Leak_DefinitelyLost</kind>
  <xwhat>
    <text>393,216 bytes in 3 blocks are definitely lost in loss record 192 of 192</text>
    <leakedbytes>393216</leakedbytes>
    <leakedblocks>3</leakedblocks>
  </xwhat>
  <stack>
    <frame>
      <ip>0x61EF87E</ip>
      <obj>/usr/libexec/valgrind/vgpreload_memcheck-amd64-linux.so</obj>
      <fn>malloc</fn>
      <dir>/builddir/build/BUILD/valgrind-3.25.1/coregrind/m_replacemalloc</dir>
      <file>vg_replace_malloc.c</file>
      <line>446</line>
    </frame>
    <frame>
      <ip>0x46B270C</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>UnknownInlinedFun</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/redhat-linux-build/boost/include/boost/context</dir>
      <file>fixedsize_stack.hpp</file>
      <line>57</line>
    </frame>
    <frame>
      <ip>0x46B270C</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>UnknownInlinedFun</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/redhat-linux-build/boost/include/boost/coroutine2/detail</dir>
      <file>create_control_block.ipp</file>
      <line>32</line>
    </frame>
    <frame>
      <ip>0x46B270C</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>UnknownInlinedFun</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/redhat-linux-build/boost/include/boost/coroutine2/detail</dir>
      <file>push_coroutine.ipp</file>
      <line>158</line>
    </frame>
    <frame>
      <ip>0x46B270C</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>UnknownInlinedFun</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/redhat-linux-build/boost/include/boost/coroutine2/detail</dir>
      <file>push_coroutine.ipp</file>
      <line>153</line>
    </frame>
    <frame>
      <ip>0x46B270C</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>UnknownInlinedFun</fn>
      <dir>/usr/include/c++/14/bits</dir>
      <file>unique_ptr.h</file>
      <line>1076</line>
    </frame>
    <frame>
      <ip>0x46B270C</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>PrimaryLogPG::do_op(boost::intrusive_ptr&lt;OpRequest&gt;&amp;)</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/osd</dir>
      <file>PrimaryLogPG.cc</file>
      <line>2624</line>
    </frame>
    <frame>
      <ip>0x45E6C0E</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>OSD::dequeue_op(boost::intrusive_ptr&lt;PG&gt;, boost::intrusive_ptr&lt;OpRequest&gt;, ThreadPool::TPHandle&amp;)</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/osd</dir>
      <file>OSD.cc</file>
      <line>10019</line>
    </frame>
    <frame>
      <ip>0x4883C78</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>ceph::osd::scheduler::PGOpItem::run(OSD*, OSDShard*, boost::intrusive_ptr&lt;PG&gt;&amp;, ThreadPool::TPHandle&amp;)</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/osd/scheduler</dir>
      <file>OpSchedulerItem.cc</file>
      <line>29</line>
    </frame>
    <frame>
      <ip>0x4610512</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>UnknownInlinedFun</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/osd/scheduler</dir>
      <file>OpSchedulerItem.h</file>
      <line>144</line>
    </frame>
    <frame>
      <ip>0x4610512</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>OSD::ShardedOpWQ::_process(unsigned int, unsigned int, ceph::heartbeat_handle_d*)</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/osd</dir>
      <file>OSD.cc</file>
      <line>11444</line>
    </frame>
    <frame>
      <ip>0x4BB4AE2</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>ShardedThreadPool::shardedthreadpool_worker(unsigned int, unsigned int)</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/common</dir>
      <file>WorkQueue.cc</file>
      <line>346</line>
    </frame>
    <frame>
      <ip>0x4BB5596</ip>
      <obj>/usr/bin/ceph-osd-classic</obj>
      <fn>ShardedThreadPool::WorkThreadSharded::entry()</fn>
      <dir>/usr/src/debug/ceph-21.3.0-1949.g6524572d.el10.x86_64/src/common</dir>
      <file>WorkQueue.h</file>
      <line>665</line>
    </frame>
    <frame>
      <ip>0x6EB9127</ip>
      <obj>/usr/lib64/libc.so.6</obj>
      <fn>start_thread</fn>
    </frame>
    <frame>
      <ip>0x6F29923</ip>
      <obj>/usr/lib64/libc.so.6</obj>
      <fn>clone</fn>
    </frame>
  </stack>

@ljflores

Copy link
Copy Markdown
Member

Removing from the batch for now, but please update with your assessment of this failure. If it needs testing again, you can reapply the "needs-qa" labe.\l.

@stzuraski898

Copy link
Copy Markdown
Contributor Author

Good to know @ljflores I'm taking a look at the leak that caused the test to exit. I think this leak would have been present before the UnknownInlinedFun suppression was added by #66432. Digging into the source of the leak.

@stzuraski898

Copy link
Copy Markdown
Contributor Author

I've found that the leak in testing wasn't caused by this PR, rather exposed by it.
Apr 23: overly broad UnknownInlinedFun addition as part of unit tests #66432
May 26: Support for Synchronous Reads in EC adds a memory leak, which gets suppressed by the changes in 66432 #67079

I believe that this leak can happen on two paths when a RADOS client calls a class method (e.g. rados.execute()) on an object in an Erasure Coded pool, the OSD needs to read the object's data before it can run the method. For EC pools this read is asynchronous, the OSD sends sub-reads to multiple OSDs and reassembles the data when they all reply. PR #67079 introduced a mechanism to handle this without blocking the OSD worker thread: it wraps the operation in a coroutine, essentially a lightweight function that can be paused mid-execution and resumed later. Each coroutine gets its own private stack, allocated from the heap (128 KiB per coroutine). That stack is freed automatically when the coroutine finishes cleanly.

The paths that can leak:

  • The operation is rejected early. do_op_impl has many early-exit checks (wrong shard, client blocklisted, object name too long, pool in error state, etc.). If any of these fire, the coroutine body reaches the cleanup lines without ever having suspended. The self-deletion occurs while the coroutine is still running, and the 128 KiB stack leaks.
  • The PG changes state while the coroutine is waiting. If the coroutine does suspend (waiting on the EC read), and the OSD then undergoes a map change (e.g. a peer goes down), on_change() deletes the owner object from outside the coroutine. The coroutine's stack holds a live C++ reference to that now-deleted object. When Boost tries to safely unwind the suspended stack, it may touch that dangling reference before it can free the memory, and the allocation escapes.

I am digging into this and will create a separate tracker, but I believe the Valgrind changes in this PR don't need changing.

@stzuraski898

Copy link
Copy Markdown
Contributor Author

Conclusion, definitely not a regression from this PR, I've added a full analysis in Tracker here: https://tracker.ceph.com/issues/79515

@stzuraski898
stzuraski898 merged commit b7dec94 into ceph:main Aug 17, 2026
15 checks passed
@github-actions

Copy link
Copy Markdown

This is an automated message by src/script/redmine-upkeep.py.

I have resolved the following tracker ticket due to the merge of this PR:

No backports are pending for the ticket. If this is incorrect, please update the tracker
ticket and reset to Pending Backport state.

Update Log: https://github.com/ceph/ceph/actions/runs/32047935703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants